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
This commit is contained in:
Devang Patel
2007-12-22 01:32:53 +00:00
parent 889ac61113
commit 01666bf74b
2 changed files with 62 additions and 2 deletions

View File

@@ -110,10 +110,10 @@ static bool CanPropagatePredecessorsForPHIs(BasicBlock *BB, BasicBlock *Succ) {
// 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;
}