virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.preservesCFG();
- AU.addRequired(DominatorSet::ID);
+ AU.addRequired<DominatorSet>();
}
// insertPiNodeFor - Insert a Pi node for V in the successors of BB if our
bool insertPiNodeFor(Value *V, BasicBlock *BB, Value *Rep = 0);
};
- RegisterPass<PiNodeInserter> X("pinodes", "Pi Node Insertion");
+ RegisterOpt<PiNodeInserter> X("pinodes", "Pi Node Insertion");
}
Pass *createPiNodeInsertionPass() { return new PiNodeInserter(); }
// Create the Pi node...
Value *Pi = Rep;
- if (Rep == 0) {
- PHINode *Phi = new PHINode(V->getType(), V->getName() + ".pi");
-
- // Insert the Pi node in the successor basic block...
- Succ->getInstList().push_front(Phi);
- Pi = Phi;
- }
+ if (Rep == 0) // Insert the Pi node in the successor basic block...
+ Pi = new PHINode(V->getType(), V->getName() + ".pi", Succ->begin());
// Loop over all of the uses of V, replacing ones that the Pi node
// dominates with references to the Pi node itself.