This code does not require random access use_lists
llvm-svn: 9156
This commit is contained in:
parent
5dbb244edb
commit
50b6858e2e
|
@ -154,19 +154,14 @@ bool PiNodeInserter::insertPiNodeFor(Value *V, BasicBlock *Succ, Value *Rep) {
|
||||||
// dominates with references to the Pi node itself.
|
// dominates with references to the Pi node itself.
|
||||||
//
|
//
|
||||||
DominatorSet &DS = getAnalysis<DominatorSet>();
|
DominatorSet &DS = getAnalysis<DominatorSet>();
|
||||||
for (unsigned i = 0; i < V->use_size(); ) {
|
for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; )
|
||||||
if (Instruction *U = dyn_cast<Instruction>(*(V->use_begin()+i)))
|
if (Instruction *U = dyn_cast<Instruction>(*I++))
|
||||||
if (U->getParent()->getParent() == Succ->getParent() &&
|
if (U->getParent()->getParent() == Succ->getParent() &&
|
||||||
DS.dominates(Succ, U->getParent())) {
|
DS.dominates(Succ, U->getParent())) {
|
||||||
// This instruction is dominated by the Pi node, replace reference to V
|
// This instruction is dominated by the Pi node, replace reference to V
|
||||||
// with a reference to the Pi node.
|
// with a reference to the Pi node.
|
||||||
//
|
//
|
||||||
U->replaceUsesOfWith(V, Pi);
|
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
|
// Set up the incoming value for the Pi node... do this after uses have been
|
||||||
|
|
Loading…
Reference in New Issue