namespace {
struct VISIBILITY_HIDDEN BreakCriticalEdges : public FunctionPass {
static char ID; // Pass identification, replacement for typeid
- BreakCriticalEdges() : FunctionPass((intptr_t)&ID) {}
+ BreakCriticalEdges() : FunctionPass(&ID) {}
virtual bool runOnFunction(Function &F);
bool NewBBDominatesDestBB = true;
// Should we update DominatorTree information?
- if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) {
+ if (DominatorTree *DT = P->getAnalysisIfAvailable<DominatorTree>()) {
DomTreeNode *TINode = DT->getNode(TIBB);
// The new block is not the immediate dominator for any other nodes, but
}
// Should we update DominanceFrontier information?
- if (DominanceFrontier *DF = P->getAnalysisToUpdate<DominanceFrontier>()) {
+ if (DominanceFrontier *DF = P->getAnalysisIfAvailable<DominanceFrontier>()) {
// If NewBBDominatesDestBB hasn't been computed yet, do so with DF.
if (!OtherPreds.empty()) {
// FIXME: IMPLEMENT THIS!
DominanceFrontier::iterator I = DF->find(DestBB);
if (I != DF->end()) {
DF->addBasicBlock(NewBB, I->second);
- // However NewBB's frontier does not include DestBB.
- DominanceFrontier::iterator NF = DF->find(NewBB);
- DF->removeFromFrontier(NF, DestBB);
+
+ if (I->second.count(DestBB)) {
+ // However NewBB's frontier does not include DestBB.
+ DominanceFrontier::iterator NF = DF->find(NewBB);
+ DF->removeFromFrontier(NF, DestBB);
+ }
}
else
DF->addBasicBlock(NewBB, DominanceFrontier::DomSetType());
}
// Update LoopInfo if it is around.
- if (LoopInfo *LI = P->getAnalysisToUpdate<LoopInfo>()) {
+ if (LoopInfo *LI = P->getAnalysisIfAvailable<LoopInfo>()) {
// If one or the other blocks were not in a loop, the new block is not
// either, and thus LI doesn't need to be updated.
if (Loop *TIL = LI->getLoopFor(TIBB))