summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-09 08:03:08 +0000
committerChris Lattner <sabre@nondot.org>2006-01-09 08:03:08 +0000
commitcda4aa6eb4cf581cfae2377055139e235c43789b (patch)
treecf6aead508c63a07755df41254163fdbe32fa4ad /llvm/lib/Transforms/Utils/LoopSimplify.cpp
parentdfa65542a17ac47210c8dca0fb43da70a0c381c3 (diff)
downloadbcm5719-llvm-cda4aa6eb4cf581cfae2377055139e235c43789b.tar.gz
bcm5719-llvm-cda4aa6eb4cf581cfae2377055139e235c43789b.zip
Teach loopsimplify to update et-forest. Patch contributed by Daniel Berlin!
llvm-svn: 25153
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopSimplify.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 2df10ce92f4..af0fe7820e6 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -69,6 +69,7 @@ namespace {
AU.addPreserved<LoopInfo>();
AU.addPreserved<DominatorSet>();
AU.addPreserved<ImmediateDominators>();
+ AU.addPreserved<ETForest>();
AU.addPreserved<DominatorTree>();
AU.addPreserved<DominanceFrontier>();
AU.addPreservedID(BreakCriticalEdgesID); // No critical edges added.
@@ -334,6 +335,7 @@ void LoopSimplify::InsertPreheaderForLoop(Loop *L) {
// the old header.
DominatorTree::Node *PHDomTreeNode =
DT.createNewNode(NewBB, DT.getNode(Header)->getIDom());
+ BasicBlock *oldHeaderIDom = DT.getNode(Header)->getIDom()->getBlock();
// Change the header node so that PNHode is the new immediate dominator
DT.changeImmediateDominator(DT.getNode(Header), PHDomTreeNode);
@@ -359,6 +361,15 @@ void LoopSimplify::InsertPreheaderForLoop(Loop *L) {
// The preheader now is the immediate dominator for the header node...
ID->setImmediateDominator(Header, NewBB);
}
+
+ // Update ET Forest information if we have it...
+ if (ETForest *EF = getAnalysisToUpdate<ETForest>()) {
+ // Whatever i-dominated the header node now immediately dominates NewBB
+ EF->addNewBlock(NewBB, oldHeaderIDom);
+
+ // The preheader now is the immediate dominator for the header node...
+ EF->setImmediateDominator(Header, NewBB);
+ }
// Update dominance frontier information...
if (DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>()) {
@@ -762,6 +773,7 @@ void LoopSimplify::UpdateDomInfoForRevectoredPreds(BasicBlock *NewBB,
NewBBIDomNode = NewBBIDomNode->getIDom();
assert(NewBBIDomNode && "No shared dominator found??");
}
+ NewBBIDom = NewBBIDomNode->getBlock();
}
// Create the new dominator tree node... and set the idom of NewBB.
@@ -775,6 +787,13 @@ void LoopSimplify::UpdateDomInfoForRevectoredPreds(BasicBlock *NewBB,
}
}
+ // Update ET-Forest information if it is active.
+ if (ETForest *EF = getAnalysisToUpdate<ETForest>()) {
+ EF->addNewBlock(NewBB, NewBBIDom);
+ if (NewBBDominatesNewBBSucc)
+ EF->setImmediateDominator(NewBBSucc, NewBB);
+ }
+
// Update dominance frontier information...
if (DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>()) {
// If NewBB dominates NewBBSucc, then DF(NewBB) is now going to be the
OpenPOWER on IntegriCloud