[llvm-commits] CVS: llvm/lib/Transforms/Scalar/TailDuplication.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Mar 16 17:38:00 PST 2004


Changes in directory llvm/lib/Transforms/Scalar:

TailDuplication.cpp updated: 1.17 -> 1.18

---
Log message:

Fix bug in previous checkin


---
Diffs of the changes:  (+7 -2)

Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp
diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.17 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.18
--- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.17	Tue Mar 16 17:29:09 2004
+++ llvm/lib/Transforms/Scalar/TailDuplication.cpp	Tue Mar 16 17:36:49 2004
@@ -157,8 +157,13 @@
         }
       } 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) {





More information about the llvm-commits mailing list