Add incoming value from header only if phi node has any use inside the loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48738 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2008-03-24 20:16:14 +00:00
parent 20b7bda692
commit 60a12907c3
2 changed files with 72 additions and 2 deletions
+3 -2
View File
@@ -1665,8 +1665,9 @@ void LoopIndexSplit::updatePHINodes(BasicBlock *ExitBB, BasicBlock *Latch,
break;
}
assert (NewV && "Unable to find new incoming value for exit block PHI");
PN->addIncoming(NewV, Header);
// Add incoming value from header only if PN has any use inside the loop.
if (NewV)
PN->addIncoming(NewV, Header);
} else if (Instruction *PHI = dyn_cast<Instruction>(V)) {
// If this instruction is IVIncrement then IV is new incoming value