diff options
author | Chris Lattner <sabre@nondot.org> | 2003-10-16 16:49:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-10-16 16:49:12 +0000 |
commit | 76590640cf8117f06098018dda463cd0cbb7ac45 (patch) | |
tree | 53340e0de2f1259fe7982b4a3e1f988713390aad /lib/Transforms/Scalar/PiNodeInsertion.cpp | |
parent | 28b2265eb9806682b51ae42b8efe196e4f0c81e2 (diff) |
This code does not require random access use_lists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/PiNodeInsertion.cpp')
-rw-r--r-- | lib/Transforms/Scalar/PiNodeInsertion.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/PiNodeInsertion.cpp b/lib/Transforms/Scalar/PiNodeInsertion.cpp index d555df788a..6e0562dddc 100644 --- a/lib/Transforms/Scalar/PiNodeInsertion.cpp +++ b/lib/Transforms/Scalar/PiNodeInsertion.cpp @@ -154,20 +154,15 @@ bool PiNodeInserter::insertPiNodeFor(Value *V, BasicBlock *Succ, Value *Rep) { // 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. |