------------------------------------------------------------------------
r258616 | majnemer | 2016-01-22 22:00:44 -0800 (Fri, 22 Jan 2016) | 3 lines
[PruneEH] Don't try to insert a terminator after another terminator
LLVM's BasicBlock has a single terminator, it is not valid to have two.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@261132
91177308-0d34-0410-b5e6-
96231b3b80d8
- changeToUnreachable(TokenInst->getNextNode(), /*UseLLVMTrap=*/false);
+ if (!isa<TerminatorInst>(TokenInst))
+ changeToUnreachable(TokenInst->getNextNode(), /*UseLLVMTrap=*/false);
} else {
// Get the list of successors of this block.
std::vector<BasicBlock *> Succs(succ_begin(BB), succ_end(BB));
} else {
// Get the list of successors of this block.
std::vector<BasicBlock *> Succs(succ_begin(BB), succ_end(BB));
; CHECK: cleanupret from %[[cp]] unwind to caller
; CHECK: cleanupret from %[[cp]] unwind to caller
+define void @test2() personality i32 (...)* @__CxxFrameHandler3 {
+ invoke void @neverthrows()
+ to label %try.cont unwind label %catchswitch
+
+try.cont:
+ ret void
+
+catchswitch:
+ %cs = catchswitch within none [label %catchpad] unwind to caller
+
+catchpad:
+ %cp = catchpad within %cs []
+ unreachable
+
+ret:
+ ret void
+}
+
+; CHECK-LABEL: define void @test2(
+; CHECK: call void @neverthrows()
+
+; CHECK: %[[cs:.*]] = catchswitch within none [label
+
+; CHECK: catchpad within %[[cs]] []
+; CHECK-NEXT: unreachable
+
declare i32 @__CxxFrameHandler3(...)
declare i32 @__CxxFrameHandler3(...)