summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/Mem2Reg.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-03-03 17:25:18 +0000
committerChris Lattner <sabre@nondot.org>2003-03-03 17:25:18 +0000
commite27406eb5951221e223b76bc592cc7946100f66c (patch)
tree0dae35ef224d9985db0d8b0b2a97dfe439cf7f7a /llvm/lib/Transforms/Scalar/Mem2Reg.cpp
parentc12e5ccdb55010c03398934a53e8bbb118659f94 (diff)
downloadbcm5719-llvm-e27406eb5951221e223b76bc592cc7946100f66c.tar.gz
bcm5719-llvm-e27406eb5951221e223b76bc592cc7946100f66c.zip
Change the mem2reg interface to accept a TargetData argument
llvm-svn: 5685
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Mem2Reg.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/Mem2Reg.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/Mem2Reg.cpp b/llvm/lib/Transforms/Scalar/Mem2Reg.cpp
index 6fbb43f6c3f..848c4d67066 100644
--- a/llvm/lib/Transforms/Scalar/Mem2Reg.cpp
+++ b/llvm/lib/Transforms/Scalar/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;
}
OpenPOWER on IntegriCloud