DEBUG_SCCP(cerr << "Marking BB Executable: " << BB);
BBExecutable.insert(BB); // Basic block is executable!
BBWorkList.push_back(BB); // Add the block to the work list!
-
- // Visit all of the PHI nodes that merge values from this block... Because
- // this block is newly executable, PHI nodes that used to be constant now
- // may not be. Note that we only mark PHI nodes that live in blocks that
- // can execute!
- //
- for (Value::use_iterator I = BB->use_begin(), E = BB->use_end(); I != E;++I)
- if (PHINode *PN = dyn_cast<PHINode>(*I))
- if (BBExecutable.count(PN->getParent()))
- visitPHINode(PN);
}
// Mark all feasible successors executable...
for (unsigned i = 0, e = SuccFeasible.size(); i != e; ++i)
- if (SuccFeasible[i])
- markExecutable(TI->getSuccessor(i));
+ if (SuccFeasible[i]) {
+ BasicBlock *Succ = TI->getSuccessor(i);
+ markExecutable(Succ);
+
+ // Visit all of the PHI nodes that merge values from this block...
+ // Because this edge may be new executable, and PHI nodes that used to be
+ // constant now may not be.
+ //
+ for (BasicBlock::iterator I = Succ->begin();
+ PHINode *PN = dyn_cast<PHINode>(*I); ++I)
+ visitPHINode(PN);
+ }
}
void SCCP::visitUnaryOperator(Instruction *I) {