[llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp

Owen Anderson resistor at mac.com
Tue Apr 17 22:26:00 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

CorrelatedExprs.cpp updated: 1.56 -> 1.57
---
Log message:

Use ETForest instead of DominatorTree.


---
Diffs of the changes:  (+11 -11)

 CorrelatedExprs.cpp |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)


Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp
diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.56 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.57
--- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.56	Thu Mar  1 01:54:15 2007
+++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp	Wed Apr 18 00:25:43 2007
@@ -224,14 +224,12 @@
     std::map<Value*, unsigned> RankMap;
     std::map<BasicBlock*, RegionInfo> RegionInfoMap;
     ETForest *EF;
-    DominatorTree *DT;
   public:
     virtual bool runOnFunction(Function &F);
 
     // We don't modify the program, so we preserve all analyses
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<ETForest>();
-      AU.addRequired<DominatorTree>();
       AU.addRequiredID(BreakCriticalEdgesID);
     };
 
@@ -302,7 +300,6 @@
   // tree.  Note that our traversal will not even touch unreachable basic
   // blocks.
   EF = &getAnalysis<ETForest>();
-  DT = &getAnalysis<DominatorTree>();
 
   std::set<BasicBlock*> VisitedBlocks;
   bool Changed = TransformRegion(&F.getEntryBlock(), VisitedBlocks);
@@ -349,14 +346,16 @@
   // blocks that are dominated by this one, we can safely propagate the
   // information down now.
   //
-  DominatorTree::Node *BBN = (*DT)[BB];
-  if (!RI.empty())        // Time opt: only propagate if we can change something
-    for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i) {
-      BasicBlock *Dominated = BBN->getChildren()[i]->getBlock();
-      assert(RegionInfoMap.find(Dominated) == RegionInfoMap.end() &&
+  std::vector<BasicBlock*> children;
+  EF->getChildren(BB, children);
+  if (!RI.empty()) {        // Time opt: only propagate if we can change something
+    for (std::vector<BasicBlock*>::iterator CI = children.begin(), E = children.end();
+         CI != E; ++CI) {
+      assert(RegionInfoMap.find(*CI) == RegionInfoMap.end() &&
              "RegionInfo should be calculated in dominanace order!");
-      getRegionInfo(Dominated) = RI;
+      getRegionInfo(*CI) = RI;
     }
+  }
 
   // Now that all of our successors have information if they deserve it,
   // propagate any information our terminator instruction finds to our
@@ -379,8 +378,9 @@
     }
 
   // Now that all of our successors have information, recursively process them.
-  for (unsigned i = 0, e = BBN->getChildren().size(); i != e; ++i)
-    Changed |= TransformRegion(BBN->getChildren()[i]->getBlock(),VisitedBlocks);
+  for (std::vector<BasicBlock*>::iterator CI = children.begin(), E = children.end();
+       CI != E; ++CI)
+    Changed |= TransformRegion(*CI, VisitedBlocks);
 
   return Changed;
 }






More information about the llvm-commits mailing list