[llvm-commits] CVS: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp LoopSimplify.cpp

Owen Anderson resistor at mac.com
Sun Apr 15 01:48:08 PDT 2007



Changes in directory llvm/lib/Transforms/Utils:

BreakCriticalEdges.cpp updated: 1.42 -> 1.43
LoopSimplify.cpp updated: 1.90 -> 1.91
---
Log message:

Remove ImmediateDominator analysis.  The same information can be obtained from DomTree.  A lot of code for 
constructing ImmediateDominator is now folded into DomTree construction.

This is part of the ongoing work for PR217: http://llvm.org/PR217 .


---
Diffs of the changes:  (+0 -50)

 BreakCriticalEdges.cpp |   24 ------------------------
 LoopSimplify.cpp       |   26 --------------------------
 2 files changed, 50 deletions(-)


Index: llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
diff -u llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.42 llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.43
--- llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp:1.42	Sat Apr  7 00:57:09 2007
+++ llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp	Sun Apr 15 03:47:27 2007
@@ -38,7 +38,6 @@
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addPreserved<ETForest>();
-      AU.addPreserved<ImmediateDominators>();
       AU.addPreserved<DominatorTree>();
       AU.addPreserved<DominanceFrontier>();
       AU.addPreserved<LoopInfo>();
@@ -196,29 +195,6 @@
     if (NewBBDominatesDestBB)
       EF->setImmediateDominator(DestBB, NewBB);
   }
-
-  // Should we update ImmediateDominator information?
-  if (ImmediateDominators *ID = P->getAnalysisToUpdate<ImmediateDominators>()) {
-    // Only do this if TIBB is reachable.
-    if (ID->get(TIBB) || &TIBB->getParent()->getEntryBlock() == TIBB) {
-      // TIBB is the new immediate dominator for NewBB.
-      ID->addNewBlock(NewBB, TIBB);
-      
-      // If NewBBDominatesDestBB hasn't been computed yet, do so with ID.
-      if (!OtherPreds.empty()) {
-        while (!OtherPreds.empty() && NewBBDominatesDestBB) {
-          NewBBDominatesDestBB = ID->dominates(DestBB, OtherPreds.back());
-          OtherPreds.pop_back();
-        }
-        OtherPreds.clear();
-      }
-      
-      // If NewBBDominatesDestBB, then NewBB dominates DestBB, otherwise it
-      // doesn't dominate anything.
-      if (NewBBDominatesDestBB)
-        ID->setImmediateDominator(DestBB, NewBB);
-    }
-  }
   
   // Should we update DominatorTree information?
   if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) {


Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.90 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.91
--- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.90	Mon Apr  9 18:38:18 2007
+++ llvm/lib/Transforms/Utils/LoopSimplify.cpp	Sun Apr 15 03:47:27 2007
@@ -68,7 +68,6 @@
       AU.addRequired<ETForest>();
 
       AU.addPreserved<LoopInfo>();
-      AU.addPreserved<ImmediateDominators>();
       AU.addPreserved<ETForest>();
       AU.addPreserved<DominatorTree>();
       AU.addPreserved<DominanceFrontier>();
@@ -749,31 +748,6 @@
   }
 
   BasicBlock *NewBBIDom = 0;
-  
-  // Update immediate dominator information if we have it.
-  if (ImmediateDominators *ID = getAnalysisToUpdate<ImmediateDominators>()) {
-    unsigned i = 0;
-    for (i = 0; i < PredBlocks.size(); ++i)
-      if (ETF.dominates(&PredBlocks[i]->getParent()->getEntryBlock(), PredBlocks[i])) {
-        NewBBIDom = PredBlocks[i];
-        break;
-      }
-    assert(i != PredBlocks.size() && "No reachable preds?");
-    for (i = i + 1; i < PredBlocks.size(); ++i) {
-      if (ETF.dominates(&PredBlocks[i]->getParent()->getEntryBlock(), PredBlocks[i]))
-        NewBBIDom = ETF.nearestCommonDominator(NewBBIDom, PredBlocks[i]);
-    }
-    assert(NewBBIDom && "No immediate dominator found??");
-  
-    // Set the immediate dominator now...
-    ID->addNewBlock(NewBB, NewBBIDom);
-
-    // If NewBB strictly dominates other blocks, we need to update their idom's
-    // now.  The only block that need adjustment is the NewBBSucc block, whose
-    // idom should currently be set to PredBlocks[0].
-    if (NewBBDominatesNewBBSucc)
-      ID->setImmediateDominator(NewBBSucc, NewBB);
-  }
 
   // Update DominatorTree information if it is active.
   if (DominatorTree *DT = getAnalysisToUpdate<DominatorTree>()) {






More information about the llvm-commits mailing list