if (SSAUpdate.HasValueForBlock(ExitBB))
continue;
- PHINode *PN = PHINode::Create(Inst.getType(), PredCache.GetNumPreds(ExitBB),
+ PHINode *PN = PHINode::Create(Inst.getType(), PredCache.size(ExitBB),
Inst.getName() + ".lcssa", ExitBB->begin());
// Add inputs from inside the loop for this PHI.
- for (BasicBlock **PI = PredCache.GetPreds(ExitBB); *PI; ++PI) {
- PN->addIncoming(&Inst, *PI);
+ for (BasicBlock *Pred : PredCache.get(ExitBB)) {
+ PN->addIncoming(&Inst, Pred);
// If the exit block has a predecessor not within the loop, arrange for
// the incoming value use corresponding to that predecessor to be
// rewritten in terms of a different LCSSA PHI.
- if (!L.contains(*PI))
+ if (!L.contains(Pred))
UsesToRewrite.push_back(
&PN->getOperandUse(PN->getOperandNumForIncomingValue(
PN->getNumIncomingValues() - 1)));
AU.addPreserved<AliasAnalysis>();
AU.addPreserved<ScalarEvolution>();
}
-
-private:
- void verifyAnalysis() const override;
};
}
return Changed;
}
-static void verifyLoop(Loop &L, DominatorTree &DT) {
- // Recurse depth-first through inner loops.
- for (Loop::iterator LI = L.begin(), LE = L.end(); LI != LE; ++LI)
- verifyLoop(**LI, DT);
-
- // Check the special guarantees that LCSSA makes.
- //assert(L.isLCSSAForm(DT) && "LCSSA form not preserved!");
-}
-
-void LCSSA::verifyAnalysis() const {
- // Verify each loop nest in the function, assuming LI still points at that
- // function's loop info.
- for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)
- verifyLoop(**I, *DT);
-}