summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-03-16 23:36:49 +0000
committerChris Lattner <sabre@nondot.org>2004-03-16 23:36:49 +0000
commita3783a577ec38eb5a16d23c01e074fe819f83722 (patch)
tree7ea0aee8d846f5b31d96c099eb9659ccc1f5e4e7 /llvm/lib
parent95057f6ad1d8af0464c30d1187b40def57d2f591 (diff)
downloadbcm5719-llvm-a3783a577ec38eb5a16d23c01e074fe819f83722.tar.gz
bcm5719-llvm-a3783a577ec38eb5a16d23c01e074fe819f83722.zip
Fix bug in previous checkin
llvm-svn: 12458
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/TailDuplication.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/TailDuplication.cpp b/llvm/lib/Transforms/Scalar/TailDuplication.cpp
index 45f0543fb29..40821e450c6 100644
--- a/llvm/lib/Transforms/Scalar/TailDuplication.cpp
+++ b/llvm/lib/Transforms/Scalar/TailDuplication.cpp
@@ -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) {
OpenPOWER on IntegriCloud