[llvm] r241891 - Tighten the verifier check for catchblock.

David Majnemer david.majnemer at gmail.com
Fri Jul 10 00:01:07 PDT 2015


Author: majnemer
Date: Fri Jul 10 02:01:07 2015
New Revision: 241891

URL: http://llvm.org/viewvc/llvm-project?rev=241891&view=rev
Log:
Tighten the verifier check for catchblock.

Modified:
    llvm/trunk/lib/IR/Verifier.cpp
    llvm/trunk/test/Feature/exception.ll

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=241891&r1=241890&r2=241891&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Fri Jul 10 02:01:07 2015
@@ -2861,9 +2861,10 @@ void Verifier::visitCatchBlockInst(Catch
 
   BasicBlock *UnwindDest = CBI.getUnwindDest();
   Instruction *I = UnwindDest->getFirstNonPHI();
-  Assert(I->isEHBlock() && !isa<LandingPadInst>(I),
-         "CatchBlockInst must unwind to an EH block which is not a landingpad.",
-         &CBI);
+  Assert(
+      isa<CatchBlockInst>(I) || isa<CatchEndBlockInst>(I),
+      "CatchBlockInst must unwind to a CatchBlockInst or a CatchEndBlockInst.",
+      &CBI);
 
   visitTerminatorInst(CBI);
 }

Modified: llvm/trunk/test/Feature/exception.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/exception.ll?rev=241891&r1=241890&r2=241891&view=diff
==============================================================================
--- llvm/trunk/test/Feature/exception.ll (original)
+++ llvm/trunk/test/Feature/exception.ll Fri Jul 10 02:01:07 2015
@@ -58,18 +58,18 @@ bb:
 
 define i8 @catchblock() personality i32 (...)* @__gxx_personality_v0 {
 entry:
-  %cbv = catchblock i8 [i7 4] to label %bb unwind label %bb2
+  br label %bb2
 bb:
   ret i8 %cbv
 bb2:
-  ret i8 42
+  %cbv = catchblock i8 [i7 4] to label %bb unwind label %bb2
 }
 
 define void @terminateblock0() personality i32 (...)* @__gxx_personality_v0 {
 entry:
-  terminateblock [i7 4] unwind label %bb
+  br label %bb
 bb:
-  ret void
+  terminateblock [i7 4] unwind label %bb
 }
 
 define void @terminateblock1() personality i32 (...)* @__gxx_personality_v0 {
@@ -85,9 +85,9 @@ entry:
 
 define void @catchendblock0() personality i32 (...)* @__gxx_personality_v0 {
 entry:
-  catchendblock unwind label %bb
+  br label %bb
 bb:
-  ret void
+  catchendblock unwind label %bb
 }
 
 define void @catchendblock1() personality i32 (...)* @__gxx_personality_v0 {





More information about the llvm-commits mailing list