aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/BreakCriticalEdges.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-04-07 05:49:29 +0000
committerOwen Anderson <resistor@mac.com>2007-04-07 05:49:29 +0000
commit2d43519454dbcf17054835ded19b031f66e31670 (patch)
treea78684855d52fa52bda4622a4ab2c1f0f7888179 /lib/Transforms/Utils/BreakCriticalEdges.cpp
parentee2b32082eff7366621ed2ab119deb96b7c26cec (diff)
Expunge DomSet from BreakCriticalEdges. This is part of the continuing
work for PR 1171. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/BreakCriticalEdges.cpp')
-rw-r--r--lib/Transforms/Utils/BreakCriticalEdges.cpp70
1 files changed, 18 insertions, 52 deletions
diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp
index adbf5847c4..5253b609b8 100644
--- a/lib/Transforms/Utils/BreakCriticalEdges.cpp
+++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp
@@ -38,9 +38,7 @@ namespace {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addPreserved<ETForest>();
- AU.addPreserved<DominatorSet>();
AU.addPreserved<ImmediateDominators>();
- AU.addPreserved<DominatorTree>();
AU.addPreserved<DominanceFrontier>();
AU.addPreserved<LoopInfo>();
@@ -108,7 +106,7 @@ bool llvm::isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum,
}
// SplitCriticalEdge - If this edge is a critical edge, insert a new node to
-// split the critical edge. This will update DominatorSet, ImmediateDominator,
+// split the critical edge. This will update ETForest, ImmediateDominator,
// DominatorTree, and DominatorFrontier information if it is available, thus
// calling this pass will not invalidate any of them. This returns true if
// the edge was split, false otherwise. This ensures that all edges to that
@@ -176,38 +174,26 @@ bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P,
if (*I != NewBB)
OtherPreds.push_back(*I);
- // NewBBDominatesDestBB is valid if OtherPreds is empty, otherwise it isn't
- // yet computed.
bool NewBBDominatesDestBB = true;
- // Should we update DominatorSet information?
- if (DominatorSet *DS = P->getAnalysisToUpdate<DominatorSet>()) {
- DominatorSet::iterator DSI = DS->find(TIBB);
- if (DSI != DS->end()) { // TIBB is reachable?
- // The blocks that dominate the new one are the blocks that dominate TIBB
- // plus the new block itself.
- DominatorSet::DomSetType DomSet = DSI->second; // Copy domset.
- DomSet.insert(NewBB); // A block always dominates itself.
- DS->addBasicBlock(NewBB, DomSet);
-
- // If NewBBDominatesDestBB hasn't been computed yet, do so with DS.
- if (!OtherPreds.empty()) {
- while (!OtherPreds.empty() && NewBBDominatesDestBB) {
- NewBBDominatesDestBB = DS->dominates(DestBB, OtherPreds.back());
- OtherPreds.pop_back();
- }
- OtherPreds.clear();
- }
-
- // If NewBBDominatesDestBB, then NewBB dominates DestBB, otherwise it
- // doesn't dominate anything. If NewBB does dominates DestBB, then it
- // dominates everything that DestBB dominates.
- if (NewBBDominatesDestBB) {
- for (DominatorSet::iterator I = DS->begin(), E = DS->end(); I != E; ++I)
- if (I->second.count(DestBB))
- I->second.insert(NewBB);
+ // Update the forest?
+ if (ETForest *EF = P->getAnalysisToUpdate<ETForest>()) {
+ // NewBB is dominated by TIBB.
+ EF->addNewBlock(NewBB, TIBB);
+
+ // If NewBBDominatesDestBB hasn't been computed yet, do so with EF.
+ if (!OtherPreds.empty()) {
+ while (!OtherPreds.empty() && NewBBDominatesDestBB) {
+ NewBBDominatesDestBB = EF->dominates(DestBB, OtherPreds.back());
+ OtherPreds.pop_back();
}
+ OtherPreds.clear();
}
+
+ // If NewBBDominatesDestBB, then NewBB dominates DestBB, otherwise it
+ // doesn't dominate anything.
+ if (NewBBDominatesDestBB)
+ EF->setImmediateDominator(DestBB, NewBB);
}
// Should we update ImmediateDominator information?
@@ -232,27 +218,7 @@ bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P,
ID->setImmediateDominator(DestBB, NewBB);
}
}
-
- // Update the forest?
- if (ETForest *EF = P->getAnalysisToUpdate<ETForest>()) {
- // NewBB is dominated by TIBB.
- EF->addNewBlock(NewBB, TIBB);
-
- // If NewBBDominatesDestBB hasn't been computed yet, do so with EF.
- if (!OtherPreds.empty()) {
- while (!OtherPreds.empty() && NewBBDominatesDestBB) {
- NewBBDominatesDestBB = EF->dominates(DestBB, OtherPreds.back());
- OtherPreds.pop_back();
- }
- OtherPreds.clear();
- }
-
- // If NewBBDominatesDestBB, then NewBB dominates DestBB, otherwise it
- // doesn't dominate anything.
- if (NewBBDominatesDestBB)
- EF->setImmediateDominator(DestBB, NewBB);
- }
-
+
// Should we update DominatorTree information?
if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) {
DominatorTree::Node *TINode = DT->getNode(TIBB);