1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[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.

llvm-svn: 258616
This commit is contained in:
David Majnemer 2016-01-23 06:00:44 +00:00
parent 865681354b
commit f62478a34a
2 changed files with 28 additions and 1 deletions

View File

@ -252,7 +252,8 @@ void PruneEH::DeleteBasicBlock(BasicBlock *BB) {
}
if (TokenInst) {
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));

View File

@ -27,4 +27,30 @@ cleanupret:
; 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(...)