Don't insert nearly as many redundant phi nodes.
[oota-llvm.git] / lib / Transforms / Scalar / GCSE.cpp
index eb68f5a2727e5ed7a1c2fd192a745b00ae57f8bf..93ed8c4fa9c663443407eb93222dfb91619e7143 100644 (file)
@@ -48,7 +48,6 @@ namespace {
     // This transformation requires dominator and immediate dominator info
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesCFG();
-      AU.addRequired<ETForest>();
       AU.addRequired<DominatorTree>();
       AU.addRequired<ValueNumbering>();
     }
@@ -68,9 +67,8 @@ bool GCSE::runOnFunction(Function &F) {
   bool Changed = false;
 
   // Get pointers to the analysis results that we will be using...
-  ETForest &EF = getAnalysis<ETForest>();
-  ValueNumbering &VN = getAnalysis<ValueNumbering>();
   DominatorTree &DT = getAnalysis<DominatorTree>();
+  ValueNumbering &VN = getAnalysis<ValueNumbering>();
 
   std::vector<Value*> EqualValues;
 
@@ -94,7 +92,7 @@ bool GCSE::runOnFunction(Function &F) {
 
   // Traverse the CFG of the function in dominator order, so that we see each
   // instruction after we see its operands.
-  for (df_iterator<DominatorTree::DomTreeNode*> DI = df_begin(DT.getRootNode()),
+  for (df_iterator<DomTreeNode*> DI = df_begin(DT.getRootNode()),
          E = df_end(DT.getRootNode()); DI != E; ++DI) {
     BasicBlock *BB = DI->getBlock();
 
@@ -145,7 +143,7 @@ bool GCSE::runOnFunction(Function &F) {
             if (OtherI->getParent() == BB)
               Dominates = BlockInsts.count(OtherI);
             else
-              Dominates = EF.dominates(OtherI->getParent(), BB);
+              Dominates = DT.dominates(OtherI->getParent(), BB);
 
             if (Dominates) {
               // Okay, we found an instruction with the same value as this one