aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp5
-rw-r--r--lib/Transforms/Utils/CloneModule.cpp3
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp1
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp4
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp2
5 files changed, 11 insertions, 4 deletions
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index d1faf01a94..f05085fca1 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -79,6 +79,9 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
assert(ValueMap.count(I) && "No mapping from source argument specified!");
#endif
+ // Clone the parameter attributes
+ NewFunc->setParamAttrs(OldFunc->getParamAttrs());
+
// Loop over all of the basic blocks in the function, cloning them as
// appropriate. Note that we save BE this way in order to handle cloning of
// recursive functions into themselves.
@@ -304,7 +307,7 @@ ConstantFoldMappedInstruction(const Instruction *I) {
/// effect of this is to copy significantly less code in cases where (for
/// example) a function call with constant arguments is inlined, and those
/// constant arguments cause a significant amount of code in the callee to be
-/// dead. Since this doesn't produce an exactly copy of the input, it can't be
+/// dead. Since this doesn't produce an exact copy of the input, it can't be
/// used for things like CloneFunction or CloneModule.
void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
DenseMap<const Value*, Value*> &ValueMap,
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp
index cd9f4b6cac..201da5be9a 100644
--- a/lib/Transforms/Utils/CloneModule.cpp
+++ b/lib/Transforms/Utils/CloneModule.cpp
@@ -66,6 +66,7 @@ Module *llvm::CloneModule(const Module *M,
new Function(cast<FunctionType>(I->getType()->getElementType()),
GlobalValue::ExternalLinkage, I->getName(), New);
NF->setCallingConv(I->getCallingConv());
+ NF->setParamAttrs(I->getParamAttrs());
ValueMap[I]= NF;
}
@@ -120,5 +121,3 @@ Module *llvm::CloneModule(const Module *M,
return New;
}
-
-// vim: sw=2
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 96ad420d34..2a6d9ae9a2 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -88,6 +88,7 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
InvokeArgs.begin(), InvokeArgs.end(),
CI->getName(), BB->getTerminator());
II->setCallingConv(CI->getCallingConv());
+ II->setParamAttrs(CI->getParamAttrs());
// Make sure that anything using the call now uses the invoke!
CI->replaceAllUsesWith(II);
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index acb2b529c2..24b167ac87 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -212,9 +212,10 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) {
std::vector<Value*> CallArgs(II->op_begin()+3, II->op_end());
// Insert a normal call instruction...
CallInst *NewCall = new CallInst(II->getCalledValue(),
- CallArgs.begin(), CallArgs.end(), "", II);
+ CallArgs.begin(), CallArgs.end(), "",II);
NewCall->takeName(II);
NewCall->setCallingConv(II->getCallingConv());
+ NewCall->setParamAttrs(II->getParamAttrs());
II->replaceAllUsesWith(NewCall);
// Insert an unconditional branch to the normal destination.
@@ -273,6 +274,7 @@ void LowerInvoke::rewriteExpensiveInvoke(InvokeInst *II, unsigned InvokeNo,
II);
NewCall->takeName(II);
NewCall->setCallingConv(II->getCallingConv());
+ NewCall->setParamAttrs(II->getParamAttrs());
II->replaceAllUsesWith(NewCall);
// Replace the invoke with an uncond branch.
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 470daf36fe..1305fd92c7 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1376,6 +1376,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
CallInst *CI = new CallInst(II->getCalledValue(),
Args.begin(), Args.end(), II->getName(), BI);
CI->setCallingConv(II->getCallingConv());
+ CI->setParamAttrs(II->getParamAttrs());
// If the invoke produced a value, the Call now does instead
II->replaceAllUsesWith(CI);
delete II;
@@ -1751,6 +1752,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
Args.begin(), Args.end(),
II->getName(), BI);
CI->setCallingConv(II->getCallingConv());
+ CI->setParamAttrs(II->getParamAttrs());
// If the invoke produced a value, the Call does now instead.
II->replaceAllUsesWith(CI);
delete II;