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

Chris Lattner lattner at cs.uiuc.edu
Thu Feb 27 16:00:05 PST 2003


Changes in directory llvm/lib/Transforms/Scalar:

LICM.cpp updated: 1.22 -> 1.23

---
Log message:

Fix bug: 2003-02-27-StoreSinkPHIs.ll


---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.22 llvm/lib/Transforms/Scalar/LICM.cpp:1.23
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.22	Wed Feb 26 13:28:55 2003
+++ llvm/lib/Transforms/Scalar/LICM.cpp	Thu Feb 27 15:59:36 2003
@@ -437,7 +437,10 @@
     for (succ_iterator SI = succ_begin(*I), SE = succ_end(*I); SI != SE; ++SI)
       if (!CurLoop->contains(*SI)) {
         // Copy all of the allocas into their memory locations...
-        Instruction *InsertPos = (*SI)->begin();
+        BasicBlock::iterator BI = (*SI)->begin();
+        while (isa<PHINode>(*BI))
+          ++BI;             // Skip over all of the phi nodes in the block...
+        Instruction *InsertPos = BI;
         for (unsigned i = 0, e = PromotedValues.size(); i != e; ++i) {
           // Load from the alloca...
           LoadInst *LI = new LoadInst(PromotedValues[i].first, "", InsertPos);





More information about the llvm-commits mailing list