aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp11
-rw-r--r--lib/Transforms/Utils/CloneModule.cpp5
2 files changed, 5 insertions, 11 deletions
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index 57369143b4..9e3fe32992 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -80,11 +80,8 @@ 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());
-
- // Clone the calling convention
- NewFunc->setCallingConv(OldFunc->getCallingConv());
+ // Clone any attributes.
+ NewFunc->copyAttributesFrom(OldFunc);
// 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
@@ -339,8 +336,8 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc,
E = OldFunc->arg_end(); II != E; ++II)
assert(ValueMap.count(II) && "No mapping from source argument specified!");
#endif
-
- PruningFunctionCloner PFC(NewFunc, OldFunc, ValueMap, Returns,
+
+ PruningFunctionCloner PFC(NewFunc, OldFunc, ValueMap, Returns,
NameSuffix, CodeInfo, TD);
// Clone the entry block, and anything recursively reachable from it.
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp
index e75f915cb9..c94c531b01 100644
--- a/lib/Transforms/Utils/CloneModule.cpp
+++ b/lib/Transforms/Utils/CloneModule.cpp
@@ -65,10 +65,7 @@ Module *llvm::CloneModule(const Module *M,
Function *NF =
Function::Create(cast<FunctionType>(I->getType()->getElementType()),
GlobalValue::ExternalLinkage, I->getName(), New);
- NF->setCallingConv(I->getCallingConv());
- NF->setParamAttrs(I->getParamAttrs());
- if (I->hasCollector())
- NF->setCollector(I->getCollector());
+ NF->copyAttributesFrom(I);
ValueMap[I]= NF;
}