From 50b6858e2e96fa37b40e6eb0ccf76f73e18ab1df Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 16 Oct 2003 16:49:12 +0000 Subject: This code does not require random access use_lists llvm-svn: 9156 --- llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp') diff --git a/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp b/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp index d555df788a1..6e0562dddc6 100644 --- a/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp +++ b/llvm/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(); - for (unsigned i = 0; i < V->use_size(); ) { - if (Instruction *U = dyn_cast(*(V->use_begin()+i))) + for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ) + if (Instruction *U = dyn_cast(*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. -- cgit v1.2.3