diff options
author | Chris Lattner <sabre@nondot.org> | 2004-03-16 23:36:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-03-16 23:36:49 +0000 |
commit | a3783a577ec38eb5a16d23c01e074fe819f83722 (patch) | |
tree | 7ea0aee8d846f5b31d96c099eb9659ccc1f5e4e7 /llvm/lib | |
parent | 95057f6ad1d8af0464c30d1187b40def57d2f591 (diff) | |
download | bcm5719-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.cpp | 9 |
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) { |