[llvm-commits] [llvm-gcc-4.2] r78863 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Jim Grosbach grosbach at apple.com
Wed Aug 12 16:40:03 PDT 2009


Author: grosbach
Date: Wed Aug 12 18:40:03 2009
New Revision: 78863

URL: http://llvm.org/viewvc/llvm-project?rev=78863&view=rev
Log:
Be more careful about which landing pad we use as a paranoia fall-through target. There's no guarantee that region 1 has a landing pad.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=78863&r1=78862&r2=78863&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Aug 12 18:40:03 2009
@@ -2030,8 +2030,10 @@
 
     // Figure out which landing pad to go to via the call_site
     // FIXME: would this be better as a switch? Probably.
+    unsigned FirstPad = 0;
     for (unsigned region = 1 ; region < LandingPads.size() ; ++region) {
       if (LandingPads[region]) {
+        if (!FirstPad) FirstPad = region;
         Value *RegionNo = ConstantInt::get(llvm::Type::Int32Ty, region - 1);
         Value *Compare = Builder.CreateICmpEQ(CallSite, RegionNo);
         // Branch on the compare.
@@ -2040,7 +2042,8 @@
         EmitBlock(NextDispatch);
       }
     }
-    Builder.CreateBr(LandingPads[1]);
+    assert(FirstPad && "EH dispatcher, but no landing pads present!");
+    Builder.CreateBr(LandingPads[FirstPad]);
   }
 }
 





More information about the llvm-commits mailing list