diff gen/toir.cpp @ 291:068cb3c60afb trunk

[svn r312] Changed assert codegen to insert an unreachable terminator after the call to the assert function, which currently calls abort(). Changed array comparison runtime support to pass the array typeinfo instead of the element typeinfo. This allows a cleaner and faster implementation.
author lindquist
date Sat, 21 Jun 2008 21:16:26 +0200
parents a3b7c19c866c
children 895e1b50cf2a
line wrap: on
line diff
--- a/gen/toir.cpp	Sat Jun 21 17:57:36 2008 +0200
+++ b/gen/toir.cpp	Sat Jun 21 21:16:26 2008 +0200
@@ -2063,8 +2063,9 @@
     p->scope() = IRScope(assertbb,endbb);
     DtoAssert(&loc, msg ? msg->toElem(p) : NULL);
 
-    if (!gIR->scopereturned())
-        llvm::BranchInst::Create(endbb, p->scopebb());
+    // assert inserts unreachable terminator
+//     if (!gIR->scopereturned())
+//         llvm::BranchInst::Create(endbb, p->scopebb());
 
     // rewrite the scope
     p->scope() = IRScope(endbb,oldend);
@@ -2243,10 +2244,9 @@
 #else
     // call the new (?) trap intrinsic
     p->ir->CreateCall(GET_INTRINSIC_DECL(trap),"");
+    new llvm::UnreachableInst(p->scopebb());
 #endif
 
-    new llvm::UnreachableInst(p->scopebb());
-
     // this terminated the basicblock, start a new one
     // this is sensible, since someone might goto behind the assert
     // and prevents compiler errors if a terminator follows the assert