[llvm-commits] CVS: llvm/lib/Transforms/Utils/CloneFunction.cpp InlineFunction.cpp
Chris Lattner
sabre at nondot.org
Tue Jan 30 15:22:56 PST 2007
Changes in directory llvm/lib/Transforms/Utils:
CloneFunction.cpp updated: 1.37 -> 1.38
InlineFunction.cpp updated: 1.50 -> 1.51
---
Log message:
The inliner/cloner can now optionally take TargetData info, which can be
used by constant folding.
---
Diffs of the changes: (+14 -11)
CloneFunction.cpp | 13 ++++++++-----
InlineFunction.cpp | 12 ++++++------
2 files changed, 14 insertions(+), 11 deletions(-)
Index: llvm/lib/Transforms/Utils/CloneFunction.cpp
diff -u llvm/lib/Transforms/Utils/CloneFunction.cpp:1.37 llvm/lib/Transforms/Utils/CloneFunction.cpp:1.38
--- llvm/lib/Transforms/Utils/CloneFunction.cpp:1.37 Tue Jan 30 17:13:49 2007
+++ llvm/lib/Transforms/Utils/CloneFunction.cpp Tue Jan 30 17:22:39 2007
@@ -158,15 +158,17 @@
std::vector<ReturnInst*> &Returns;
const char *NameSuffix;
ClonedCodeInfo *CodeInfo;
+ const TargetData *TD;
public:
PruningFunctionCloner(Function *newFunc, const Function *oldFunc,
std::map<const Value*, Value*> &valueMap,
std::vector<ReturnInst*> &returns,
const char *nameSuffix,
- ClonedCodeInfo *codeInfo)
+ ClonedCodeInfo *codeInfo,
+ const TargetData *td)
: NewFunc(newFunc), OldFunc(oldFunc), ValueMap(valueMap), Returns(returns),
- NameSuffix(nameSuffix), CodeInfo(codeInfo) {
+ NameSuffix(nameSuffix), CodeInfo(codeInfo), TD(td) {
}
/// CloneBlock - The specified block is found to be reachable, clone it and
@@ -290,7 +292,7 @@
else
return 0; // All operands not constant!
- return ConstantFoldInstOperands(I, &Ops[0], Ops.size());
+ return ConstantFoldInstOperands(I, &Ops[0], Ops.size(), TD);
}
/// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto,
@@ -304,7 +306,8 @@
std::map<const Value*, Value*> &ValueMap,
std::vector<ReturnInst*> &Returns,
const char *NameSuffix,
- ClonedCodeInfo *CodeInfo) {
+ ClonedCodeInfo *CodeInfo,
+ const TargetData *TD) {
assert(NameSuffix && "NameSuffix cannot be null!");
#ifndef NDEBUG
@@ -314,7 +317,7 @@
#endif
PruningFunctionCloner PFC(NewFunc, OldFunc, ValueMap, Returns,
- NameSuffix, CodeInfo);
+ NameSuffix, CodeInfo, TD);
// Clone the entry block, and anything recursively reachable from it.
PFC.CloneBlock(&OldFunc->getEntryBlock());
Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.50 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.51
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.50 Tue Jan 30 14:08:38 2007
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp Tue Jan 30 17:22:39 2007
@@ -22,11 +22,11 @@
#include "llvm/Support/CallSite.h"
using namespace llvm;
-bool llvm::InlineFunction(CallInst *CI, CallGraph *CG) {
- return InlineFunction(CallSite(CI), CG);
+bool llvm::InlineFunction(CallInst *CI, CallGraph *CG, const TargetData *TD) {
+ return InlineFunction(CallSite(CI), CG, TD);
}
-bool llvm::InlineFunction(InvokeInst *II, CallGraph *CG) {
- return InlineFunction(CallSite(II), CG);
+bool llvm::InlineFunction(InvokeInst *II, CallGraph *CG, const TargetData *TD) {
+ return InlineFunction(CallSite(II), CG, TD);
}
/// HandleInlinedInvoke - If we inlined an invoke site, we need to convert calls
@@ -177,7 +177,7 @@
// exists in the instruction stream. Similiarly this will inline a recursive
// function by one level.
//
-bool llvm::InlineFunction(CallSite CS, CallGraph *CG) {
+bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
Instruction *TheCall = CS.getInstruction();
assert(TheCall->getParent() && TheCall->getParent()->getParent() &&
"Instruction not in function!");
@@ -225,7 +225,7 @@
// (which can happen, e.g., because an argument was constant), but we'll be
// happy with whatever the cloner can do.
CloneAndPruneFunctionInto(Caller, CalledFunc, ValueMap, Returns, ".i",
- &InlinedFunctionInfo);
+ &InlinedFunctionInfo, TD);
// Remember the first block that is newly cloned over.
FirstNewBlock = LastBlock; ++FirstNewBlock;
More information about the llvm-commits
mailing list