Fix bug: SimplifyCFG/2003-08-05-InvokeCrash.ll
Fix bug: SimplifyCFG/2003-08-05-MishandleInvoke.ll
llvm-svn: 7599
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index e191044..1adbef9 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -201,7 +201,8 @@
}
BasicBlock *OnlySucc = 0;
- if (OnlyPred && OnlyPred != BB) { // Don't break self loops
+ if (OnlyPred && OnlyPred != BB && // Don't break self loops
+ OnlyPred->getTerminator()->getOpcode() != Instruction::Invoke) {
// Check to see if there is only one distinct successor...
succ_iterator SI(succ_begin(OnlyPred)), SE(succ_end(OnlyPred));
OnlySucc = BB;