If succ has succ itself as one of the predecessors then do
not merge current bb and succ even if bb's terminator is
unconditional branch to succ.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45305 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 1305fd9..ee283a0 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -110,10 +110,10 @@
// update the PHI nodes correctly.
if (!isa<PHINode>(BB->begin()) || Succ->getSinglePredecessor()) return true;
- // If the predecessors of Succ are only BB and Succ itself, handle it.
+ // If the predecessors of Succ are only BB, handle it.
bool IsSafe = true;
for (pred_iterator PI = pred_begin(Succ), E = pred_end(Succ); PI != E; ++PI)
- if (*PI != Succ && *PI != BB) {
+ if (*PI != BB) {
IsSafe = false;
break;
}