diff options
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 3 | ||||
-rw-r--r-- | llvm/test/Transforms/SimplifyCFG/wineh-unreachable.ll | 20 |
2 files changed, 21 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index e435537c3a7..69c08e55283 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -3178,8 +3178,7 @@ bool SimplifyCFGOpt::SimplifyUnreachable(UnreachableInst *UI) { isa<CatchEndPadInst>(TI) || isa<TerminatePadInst>(TI)) { removeUnwindEdge(TI->getParent()); Changed = true; - } else if (isa<CleanupReturnInst>(TI) || isa<CleanupEndPadInst>(TI) || - isa<CatchReturnInst>(TI)) { + } else if (isa<CleanupReturnInst>(TI) || isa<CleanupEndPadInst>(TI)) { new UnreachableInst(TI->getContext(), TI); TI->eraseFromParent(); Changed = true; diff --git a/llvm/test/Transforms/SimplifyCFG/wineh-unreachable.ll b/llvm/test/Transforms/SimplifyCFG/wineh-unreachable.ll index 7db883b2412..31d567f6492 100644 --- a/llvm/test/Transforms/SimplifyCFG/wineh-unreachable.ll +++ b/llvm/test/Transforms/SimplifyCFG/wineh-unreachable.ll @@ -86,3 +86,23 @@ unreachable.unwind: cleanuppad [] unreachable } + +; CHECK-LABEL: define void @test5() +define void @test5() personality i8* bitcast (void ()* @Personality to i8*) { +entry: + invoke void @f() + to label %exit unwind label %catch.pad + +catch.pad: + %catch = catchpad [] + to label %catch.body unwind label %catch.end + +catch.body: + catchret %catch to label %exit + +catch.end: + catchendpad unwind to caller + +exit: + unreachable +} |