mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Properly update MachineDominators when splitting critical edge.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111574 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -468,8 +468,31 @@ MachineBasicBlock::SplitCriticalEdge(MachineBasicBlock *Succ, Pass *P) {
|
|||||||
LV->addNewBlock(NMBB, this, Succ);
|
LV->addNewBlock(NMBB, this, Succ);
|
||||||
|
|
||||||
if (MachineDominatorTree *MDT =
|
if (MachineDominatorTree *MDT =
|
||||||
P->getAnalysisIfAvailable<MachineDominatorTree>())
|
P->getAnalysisIfAvailable<MachineDominatorTree>()) {
|
||||||
MDT->addNewBlock(NMBB, this);
|
// Update dominator information.
|
||||||
|
MachineDomTreeNode *SucccDTNode = MDT->getNode(Succ);
|
||||||
|
|
||||||
|
bool IsNewIDom = true;
|
||||||
|
for (const_pred_iterator PI = Succ->pred_begin(), E = Succ->pred_end();
|
||||||
|
PI != E; ++PI) {
|
||||||
|
MachineBasicBlock *PredBB = *PI;
|
||||||
|
if (PredBB == NMBB)
|
||||||
|
continue;
|
||||||
|
if (!MDT->dominates(SucccDTNode, MDT->getNode(PredBB))) {
|
||||||
|
IsNewIDom = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We know "this" dominates the newly created basic block.
|
||||||
|
MachineDomTreeNode *NewDTNode = MDT->addNewBlock(NMBB, this);
|
||||||
|
|
||||||
|
// If all the other predecessors of "Succ" are dominated by "Succ" itself
|
||||||
|
// then the new block is the new immediate dominator of "Succ". Otherwise,
|
||||||
|
// the new block doesn't dominate anything.
|
||||||
|
if (IsNewIDom)
|
||||||
|
MDT->changeImmediateDominator(SucccDTNode, NewDTNode);
|
||||||
|
}
|
||||||
|
|
||||||
if (MachineLoopInfo *MLI = P->getAnalysisIfAvailable<MachineLoopInfo>())
|
if (MachineLoopInfo *MLI = P->getAnalysisIfAvailable<MachineLoopInfo>())
|
||||||
if (MachineLoop *TIL = MLI->getLoopFor(this)) {
|
if (MachineLoop *TIL = MLI->getLoopFor(this)) {
|
||||||
|
Reference in New Issue
Block a user