From ec83dbdc5e195a1952e27c0cdd1311b8bcbe885a Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 10 Jul 2015 07:01:07 +0000 Subject: [PATCH] Tighten the verifier check for catchblock. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241891 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Verifier.cpp | 7 ++++--- test/Feature/exception.ll | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index 6def326a618..c85be99bc24 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -2861,9 +2861,10 @@ void Verifier::visitCatchBlockInst(CatchBlockInst &CBI) { BasicBlock *UnwindDest = CBI.getUnwindDest(); Instruction *I = UnwindDest->getFirstNonPHI(); - Assert(I->isEHBlock() && !isa(I), - "CatchBlockInst must unwind to an EH block which is not a landingpad.", - &CBI); + Assert( + isa(I) || isa(I), + "CatchBlockInst must unwind to a CatchBlockInst or a CatchEndBlockInst.", + &CBI); visitTerminatorInst(CBI); } diff --git a/test/Feature/exception.ll b/test/Feature/exception.ll index 3fd3e087acf..3befbcd2430 100644 --- a/test/Feature/exception.ll +++ b/test/Feature/exception.ll @@ -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 { -- 2.34.1