summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp4
-rw-r--r--llvm/lib/Transforms/Scalar/Mem2Reg.cpp7
2 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 334ede39d98..128a0d82335 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -27,6 +27,7 @@
#include "llvm/Analysis/Dominators.h"
#include "llvm/Instructions.h"
#include "llvm/DerivedTypes.h"
+#include "llvm/Target/TargetData.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/Support/CFG.h"
#include "Support/Statistic.h"
@@ -457,7 +458,8 @@ void LICM::PromoteValuesInLoop() {
PromotedAllocas.reserve(PromotedValues.size());
for (unsigned i = 0, e = PromotedValues.size(); i != e; ++i)
PromotedAllocas.push_back(PromotedValues[i].first);
- PromoteMemToReg(PromotedAllocas, getAnalysis<DominanceFrontier>());
+ PromoteMemToReg(PromotedAllocas, getAnalysis<DominanceFrontier>(),
+ AA->getTargetData());
}
/// findPromotableValuesInLoop - Check the current loop for stores to definate
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