mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-12 22:30:12 +00:00
Preserve the DominanceFrontier analysis in the LoopDeletion pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65359 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
002ec1482c
commit
d0a90b9876
@ -53,6 +53,7 @@ namespace {
|
|||||||
AU.addPreserved<LoopInfo>();
|
AU.addPreserved<LoopInfo>();
|
||||||
AU.addPreservedID(LoopSimplifyID);
|
AU.addPreservedID(LoopSimplifyID);
|
||||||
AU.addPreservedID(LCSSAID);
|
AU.addPreservedID(LCSSAID);
|
||||||
|
AU.addPreserved<DominanceFrontier>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -228,6 +229,7 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
|
|||||||
// Update the dominator tree and remove the instructions and blocks that will
|
// Update the dominator tree and remove the instructions and blocks that will
|
||||||
// be deleted from the reference counting scheme.
|
// be deleted from the reference counting scheme.
|
||||||
DominatorTree& DT = getAnalysis<DominatorTree>();
|
DominatorTree& DT = getAnalysis<DominatorTree>();
|
||||||
|
DominanceFrontier* DF = getAnalysisIfAvailable<DominanceFrontier>();
|
||||||
SmallPtrSet<DomTreeNode*, 8> ChildNodes;
|
SmallPtrSet<DomTreeNode*, 8> ChildNodes;
|
||||||
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
|
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
|
||||||
LI != LE; ++LI) {
|
LI != LE; ++LI) {
|
||||||
@ -235,12 +237,15 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
|
|||||||
// allows us to remove the domtree entry for the block.
|
// allows us to remove the domtree entry for the block.
|
||||||
ChildNodes.insert(DT[*LI]->begin(), DT[*LI]->end());
|
ChildNodes.insert(DT[*LI]->begin(), DT[*LI]->end());
|
||||||
for (SmallPtrSet<DomTreeNode*, 8>::iterator DI = ChildNodes.begin(),
|
for (SmallPtrSet<DomTreeNode*, 8>::iterator DI = ChildNodes.begin(),
|
||||||
DE = ChildNodes.end(); DI != DE; ++DI)
|
DE = ChildNodes.end(); DI != DE; ++DI) {
|
||||||
DT.changeImmediateDominator(*DI, DT[preheader]);
|
DT.changeImmediateDominator(*DI, DT[preheader]);
|
||||||
|
if (DF) DF->changeImmediateDominator((*DI)->getBlock(), preheader, &DT);
|
||||||
|
}
|
||||||
|
|
||||||
ChildNodes.clear();
|
ChildNodes.clear();
|
||||||
DT.eraseNode(*LI);
|
DT.eraseNode(*LI);
|
||||||
|
if (DF) DF->removeBlock(*LI);
|
||||||
|
|
||||||
// Remove instructions that we're deleting from ScalarEvolution.
|
// Remove instructions that we're deleting from ScalarEvolution.
|
||||||
for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
|
for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
|
||||||
BI != BE; ++BI)
|
BI != BE; ++BI)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user