Fix bug in previous checkin

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12458 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-03-16 23:36:49 +00:00
parent 24ad00db5a
commit 50eafbc828

View File

@ -157,8 +157,13 @@ void TailDup::eliminateUnconditionalBranch(BranchInst *Branch) {
}
} else if (PHINode *PN = dyn_cast<PHINode>(cast<Instruction>(*UI))) {
// If the user of this instruction is a PHI node in the current block,
// spill the value.
ShouldDemote = true;
// which has an entry from another block using the value, spill it.
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
if (PN->getIncomingValue(i) == I &&
PN->getIncomingBlock(i) != DestBlock) {
ShouldDemote = true;
break;
}
}
if (ShouldDemote) {