[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LICM.cpp Mem2Reg.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Mar 3 11:26:02 PST 2003
Changes in directory llvm/lib/Transforms/Scalar:
LICM.cpp updated: 1.24 -> 1.25
Mem2Reg.cpp updated: 1.1 -> 1.2
---
Log message:
Change the mem2reg interface to accept a TargetData argument
---
Diffs of the changes:
Index: llvm/lib/Transforms/Scalar/LICM.cpp
diff -u llvm/lib/Transforms/Scalar/LICM.cpp:1.24 llvm/lib/Transforms/Scalar/LICM.cpp:1.25
--- llvm/lib/Transforms/Scalar/LICM.cpp:1.24 Fri Feb 28 13:21:40 2003
+++ llvm/lib/Transforms/Scalar/LICM.cpp Mon Mar 3 11:25:16 2003
@@ -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 @@
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
Index: llvm/lib/Transforms/Scalar/Mem2Reg.cpp
diff -u llvm/lib/Transforms/Scalar/Mem2Reg.cpp:1.1 llvm/lib/Transforms/Scalar/Mem2Reg.cpp:1.2
--- llvm/lib/Transforms/Scalar/Mem2Reg.cpp:1.1 Sat Feb 22 17:57:06 2003
+++ llvm/lib/Transforms/Scalar/Mem2Reg.cpp Mon Mar 3 11:25:16 2003
@@ -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 @@
//
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<DominanceFrontier>();
+ AU.addRequired<TargetData>();
AU.setPreservesCFG();
}
};
@@ -34,6 +36,7 @@
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 @@
// 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;
}
More information about the llvm-commits
mailing list