aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-30 23:22:39 +0000
committerChris Lattner <sabre@nondot.org>2007-01-30 23:22:39 +0000
commit1dfdf8255e803d6376f5fe94a113f892e796ae6c (patch)
tree50588bd83100c2b9c259ce6b665d15cc4680b343 /lib/Transforms/Utils/CloneFunction.cpp
parent3cab071f6f1534ff424d4b947715ae758edca790 (diff)
downloadexternal_llvm-1dfdf8255e803d6376f5fe94a113f892e796ae6c.zip
external_llvm-1dfdf8255e803d6376f5fe94a113f892e796ae6c.tar.gz
external_llvm-1dfdf8255e803d6376f5fe94a113f892e796ae6c.tar.bz2
The inliner/cloner can now optionally take TargetData info, which can be
used by constant folding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index f47bf1b..12dff3b 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -158,15 +158,17 @@ namespace {
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 @@ ConstantFoldMappedInstruction(const Instruction *I) {
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 @@ void llvm::CloneAndPruneFunctionInto(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) {
assert(NameSuffix && "NameSuffix cannot be null!");
#ifndef NDEBUG
@@ -314,7 +317,7 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
#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());