diff options
author | Chris Lattner <sabre@nondot.org> | 2003-03-03 17:25:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-03-03 17:25:18 +0000 |
commit | fb743a937f6856e3ab1f8ed599677038750a550e (patch) | |
tree | 597e36aff252a30049f388d31d50db5a36b939e3 /lib/Transforms/Utils/Mem2Reg.cpp | |
parent | 088b639e3a168686f16bb292e08b952d01a25b7d (diff) |
Change the mem2reg interface to accept a TargetData argument
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5685 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/Mem2Reg.cpp')
-rw-r--r-- | lib/Transforms/Utils/Mem2Reg.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/Mem2Reg.cpp b/lib/Transforms/Utils/Mem2Reg.cpp index 6fbb43f6c3..848c4d6706 100644 --- a/lib/Transforms/Utils/Mem2Reg.cpp +++ b/lib/Transforms/Utils/Mem2Reg.cpp @@ -10,6 +10,7 @@ #include "llvm/Analysis/Dominators.h" #include "llvm/iMemory.h" #include "llvm/Function.h" +#include "llvm/Target/TargetData.h" #include "Support/Statistic.h" namespace { @@ -25,6 +26,7 @@ namespace { // virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<DominanceFrontier>(); + AU.addRequired<TargetData>(); AU.setPreservesCFG(); } }; @@ -34,6 +36,7 @@ namespace { bool PromotePass::runOnFunction(Function &F) { std::vector<AllocaInst*> Allocas; + const TargetData &TD = getAnalysis<TargetData>(); BasicBlock &BB = F.getEntryNode(); // Get the entry node for the function @@ -41,11 +44,11 @@ bool PromotePass::runOnFunction(Function &F) { // the entry node for (BasicBlock::iterator I = BB.begin(), E = --BB.end(); I != E; ++I) if (AllocaInst *AI = dyn_cast<AllocaInst>(&*I)) // Is it an alloca? - if (isAllocaPromotable(AI)) + if (isAllocaPromotable(AI, TD)) Allocas.push_back(AI); if (!Allocas.empty()) { - PromoteMemToReg(Allocas, getAnalysis<DominanceFrontier>()); + PromoteMemToReg(Allocas, getAnalysis<DominanceFrontier>(), TD); NumPromoted += Allocas.size(); return true; } |