diff options
author | Dan Gohman <gohman@apple.com> | 2009-02-24 01:21:53 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-02-24 01:21:53 +0000 |
commit | e6698847490224d4ade0a5e0f1c8784f23201c0b (patch) | |
tree | 2c159153e2eb06dcb707f1418d7d6c981c3a5e4a /llvm/lib/Transforms | |
parent | 50c632411939e318dbb308f4a17578c674871cc0 (diff) | |
download | bcm5719-llvm-e6698847490224d4ade0a5e0f1c8784f23201c0b.tar.gz bcm5719-llvm-e6698847490224d4ade0a5e0f1c8784f23201c0b.zip |
Preserve the DominanceFrontier analysis in the LoopDeletion pass.
llvm-svn: 65359
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopDeletion.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp index ac807a4c9b2..b64131cf18c 100644 --- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp +++ b/llvm/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) |