[llvm-commits] CVS: llvm/lib/Transforms/Utils/Mem2Reg.cpp PromoteMemoryToRegister.cpp

Devang Patel dpatel at apple.com
Wed Apr 25 11:33:03 PDT 2007



Changes in directory llvm/lib/Transforms/Utils:

Mem2Reg.cpp updated: 1.25 -> 1.26
PromoteMemoryToRegister.cpp updated: 1.99 -> 1.100
---
Log message:

Mem2Reg does not need TargetData.


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

 Mem2Reg.cpp                 |    5 +----
 PromoteMemoryToRegister.cpp |   12 +++++-------
 2 files changed, 6 insertions(+), 11 deletions(-)


Index: llvm/lib/Transforms/Utils/Mem2Reg.cpp
diff -u llvm/lib/Transforms/Utils/Mem2Reg.cpp:1.25 llvm/lib/Transforms/Utils/Mem2Reg.cpp:1.26
--- llvm/lib/Transforms/Utils/Mem2Reg.cpp:1.25	Wed Apr 25 12:15:20 2007
+++ llvm/lib/Transforms/Utils/Mem2Reg.cpp	Wed Apr 25 13:32:35 2007
@@ -19,7 +19,6 @@
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Instructions.h"
 #include "llvm/Function.h"
-#include "llvm/Target/TargetData.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/Compiler.h"
 using namespace llvm;
@@ -38,7 +37,6 @@
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<ETForest>();
       AU.addRequired<DominanceFrontier>();
-      AU.addRequired<TargetData>();
       AU.setPreservesCFG();
       // This is a cluster of orthogonal Transforms
       AU.addPreserved<UnifyFunctionExitNodes>();
@@ -54,7 +52,6 @@
 
 bool PromotePass::runOnFunction(Function &F) {
   std::vector<AllocaInst*> Allocas;
-  const TargetData &TD = getAnalysis<TargetData>();
 
   BasicBlock &BB = F.getEntryBlock();  // Get the entry node for the function
 
@@ -75,7 +72,7 @@
 
     if (Allocas.empty()) break;
 
-    PromoteMemToReg(Allocas, ET, DF, TD);
+    PromoteMemToReg(Allocas, ET, DF);
     NumPromoted += Allocas.size();
     Changed = true;
   }


Index: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
diff -u llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.99 llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.100
--- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.99	Wed Apr 25 12:15:20 2007
+++ llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp	Wed Apr 25 13:32:35 2007
@@ -90,7 +90,6 @@
     SmallVector<AllocaInst*, 16> &RetryList;
     ETForest &ET;
     DominanceFrontier &DF;
-    const TargetData &TD;
 
     /// AST - An AliasSetTracker object to update.  If null, don't update it.
     ///
@@ -128,9 +127,8 @@
   public:
     PromoteMem2Reg(const std::vector<AllocaInst*> &A,
                    SmallVector<AllocaInst*, 16> &Retry, ETForest &et,
-                   DominanceFrontier &df, const TargetData &td,
-                   AliasSetTracker *ast)
-      : Allocas(A), RetryList(Retry), ET(et), DF(df), TD(td), AST(ast) {}
+                   DominanceFrontier &df, AliasSetTracker *ast)
+      : Allocas(A), RetryList(Retry), ET(et), DF(df), AST(ast) {}
 
     void run();
 
@@ -806,12 +804,12 @@
 ///
 void llvm::PromoteMemToReg(const std::vector<AllocaInst*> &Allocas,
                            ETForest &ET, DominanceFrontier &DF,
-                           const TargetData &TD, AliasSetTracker *AST) {
+                           AliasSetTracker *AST) {
   // If there is nothing to do, bail out...
   if (Allocas.empty()) return;
 
   SmallVector<AllocaInst*, 16> RetryList;
-  PromoteMem2Reg(Allocas, RetryList, ET, DF, TD, AST).run();
+  PromoteMem2Reg(Allocas, RetryList, ET, DF, AST).run();
 
   // PromoteMem2Reg may not have been able to promote all of the allocas in one
   // pass, run it again if needed.
@@ -829,7 +827,7 @@
 
     NewAllocas.assign(RetryList.begin(), RetryList.end());
     RetryList.clear();
-    PromoteMem2Reg(NewAllocas, RetryList, ET, DF, TD, AST).run();
+    PromoteMem2Reg(NewAllocas, RetryList, ET, DF, AST).run();
     NewAllocas.clear();
   }
 }






More information about the llvm-commits mailing list