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

Chris Lattner lattner at cs.uiuc.edu
Thu Oct 16 11:50:01 PDT 2003


Changes in directory llvm/lib/Transforms/Scalar:

PiNodeInsertion.cpp updated: 1.11 -> 1.12

---
Log message:

This code does not require random access use_lists


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

Index: llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp
diff -u llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp:1.11 llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp:1.12
--- llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp:1.11	Fri Oct 10 12:50:50 2003
+++ llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp	Thu Oct 16 11:49:12 2003
@@ -154,20 +154,15 @@
   // dominates with references to the Pi node itself.
   //
   DominatorSet &DS = getAnalysis<DominatorSet>();
-  for (unsigned i = 0; i < V->use_size(); ) {
-    if (Instruction *U = dyn_cast<Instruction>(*(V->use_begin()+i)))
+  for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; )
+    if (Instruction *U = dyn_cast<Instruction>(*I++))
       if (U->getParent()->getParent() == Succ->getParent() &&
           DS.dominates(Succ, U->getParent())) {
         // This instruction is dominated by the Pi node, replace reference to V
         // with a reference to the Pi node.
         //
         U->replaceUsesOfWith(V, Pi);
-        continue;           // Do not skip the next use...
       }
-      
-    // This use is not dominated by the Pi node, skip it...
-    ++i;
-  }
     
   // Set up the incoming value for the Pi node... do this after uses have been
   // replaced, because we don't want the Pi node to refer to itself.





More information about the llvm-commits mailing list