summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-02-24 01:21:53 +0000
committerDan Gohman <gohman@apple.com>2009-02-24 01:21:53 +0000
commitd0a90b987673e22985c3407f413c76eb104777c4 (patch)
tree936c26a40135278b4367b20a3235dad723fac4e2 /lib
parent002ec1482c83003c6aef841395271aa5993d916a (diff)
downloadllvm-d0a90b987673e22985c3407f413c76eb104777c4.tar.gz
llvm-d0a90b987673e22985c3407f413c76eb104777c4.tar.bz2
llvm-d0a90b987673e22985c3407f413c76eb104777c4.tar.xz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/LoopDeletion.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopDeletion.cpp b/lib/Transforms/Scalar/LoopDeletion.cpp
index ac807a4c9b..b64131cf18 100644
--- a/lib/Transforms/Scalar/LoopDeletion.cpp
+++ b/lib/Transforms/Scalar/LoopDeletion.cpp
@@ -53,6 +53,7 @@ namespace {
AU.addPreserved<LoopInfo>();
AU.addPreservedID(LoopSimplifyID);
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
// 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 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
// 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)