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 | 50eafbc828610b16e4324c777ac4e5d82b0676cc (patch) | |
tree | 036d75ccf85dd8691d7da54d7ac5b7243fc75996 /lib/Transforms/Scalar/TailDuplication.cpp | |
parent | 24ad00db5a7f86b1ce725d831058347d62edfe8b (diff) |
Fix bug in previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12458 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/TailDuplication.cpp')
-rw-r--r-- | lib/Transforms/Scalar/TailDuplication.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 45f0543fb2..40821e450c 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/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) { |