[llvm-commits] [llvm] r65359 - /llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
Dan Gohman
gohman at apple.com
Mon Feb 23 17:21:53 PST 2009
Author: djg
Date: Mon Feb 23 19:21:53 2009
New Revision: 65359
URL: http://llvm.org/viewvc/llvm-project?rev=65359&view=rev
Log:
Preserve the DominanceFrontier analysis in the LoopDeletion pass.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=65359&r1=65358&r2=65359&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Mon Feb 23 19:21:53 2009
@@ -53,6 +53,7 @@
AU.addPreserved<LoopInfo>();
AU.addPreservedID(LoopSimplifyID);
AU.addPreservedID(LCSSAID);
+ AU.addPreserved<DominanceFrontier>();
}
};
}
@@ -228,6 +229,7 @@
// Update the dominator tree and remove the instructions and blocks that will
// be deleted from the reference counting scheme.
DominatorTree& DT = getAnalysis<DominatorTree>();
+ DominanceFrontier* DF = getAnalysisIfAvailable<DominanceFrontier>();
SmallPtrSet<DomTreeNode*, 8> ChildNodes;
for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
LI != LE; ++LI) {
@@ -235,12 +237,15 @@
// allows us to remove the domtree entry for the block.
ChildNodes.insert(DT[*LI]->begin(), DT[*LI]->end());
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]);
+ if (DF) DF->changeImmediateDominator((*DI)->getBlock(), preheader, &DT);
+ }
ChildNodes.clear();
DT.eraseNode(*LI);
-
+ if (DF) DF->removeBlock(*LI);
+
// Remove instructions that we're deleting from ScalarEvolution.
for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end();
BI != BE; ++BI)
More information about the llvm-commits
mailing list