diff options
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r-- | lib/Transforms/IPO/ArgumentPromotion.cpp | 6 | ||||
-rw-r--r-- | lib/Transforms/IPO/DeadArgumentElimination.cpp | 9 | ||||
-rw-r--r-- | lib/Transforms/IPO/ExtractGV.cpp | 5 | ||||
-rw-r--r-- | lib/Transforms/IPO/StructRetPromotion.cpp | 2 |
4 files changed, 6 insertions, 16 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp index b3d783d2ae..7dd94f5bc8 100644 --- a/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -478,15 +478,13 @@ Function *ArgPromotion::DoPromotion(Function *F, // Create the new function body and insert it into the module... Function *NF = Function::Create(NFTy, F->getLinkage(), F->getName()); - NF->setCallingConv(F->getCallingConv()); + NF->copyAttributesFrom(F); // Recompute the parameter attributes list based on the new arguments for // the function. NF->setParamAttrs(PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end())); ParamAttrsVec.clear(); - - if (F->hasCollector()) - NF->setCollector(F->getCollector()); + F->getParent()->getFunctionList().insert(F, NF); NF->takeName(F); diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 9b3efe0962..2dab695224 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -163,10 +163,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) { // Create the new function body and insert it into the module... Function *NF = Function::Create(NFTy, Fn.getLinkage()); - NF->setCallingConv(Fn.getCallingConv()); - NF->setParamAttrs(Fn.getParamAttrs()); - if (Fn.hasCollector()) - NF->setCollector(Fn.getCollector()); + NF->copyAttributesFrom(&Fn); Fn.getParent()->getFunctionList().insert(&Fn, NF); NF->takeName(&Fn); @@ -556,10 +553,8 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) { // Create the new function body and insert it into the module... Function *NF = Function::Create(NFTy, F->getLinkage()); - NF->setCallingConv(F->getCallingConv()); + NF->copyAttributesFrom(F); NF->setParamAttrs(NewPAL); - if (F->hasCollector()) - NF->setCollector(F->getCollector()); F->getParent()->getFunctionList().insert(F, NF); NF->takeName(F); diff --git a/lib/Transforms/IPO/ExtractGV.cpp b/lib/Transforms/IPO/ExtractGV.cpp index 46232b880b..03a8e5cebc 100644 --- a/lib/Transforms/IPO/ExtractGV.cpp +++ b/lib/Transforms/IPO/ExtractGV.cpp @@ -123,10 +123,7 @@ namespace { if (std::find(Named.begin(), Named.end(), &*I) == Named.end()) { Function *New = Function::Create(I->getFunctionType(), GlobalValue::ExternalLinkage); - New->setCallingConv(I->getCallingConv()); - New->setParamAttrs(I->getParamAttrs()); - if (I->hasCollector()) - New->setCollector(I->getCollector()); + New->copyAttributesFrom(I); // If it's not the named function, delete the body of the function I->dropAllReferences(); diff --git a/lib/Transforms/IPO/StructRetPromotion.cpp b/lib/Transforms/IPO/StructRetPromotion.cpp index f857dce669..174a6fa767 100644 --- a/lib/Transforms/IPO/StructRetPromotion.cpp +++ b/lib/Transforms/IPO/StructRetPromotion.cpp @@ -232,7 +232,7 @@ Function *SRETPromotion::cloneFunctionBody(Function *F, FunctionType *NFTy = FunctionType::get(STy, Params, FTy->isVarArg()); Function *NF = Function::Create(NFTy, F->getLinkage(), F->getName()); - NF->setCallingConv(F->getCallingConv()); + NF->copyAttributesFrom(F); NF->setParamAttrs(PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end())); F->getParent()->getFunctionList().insert(F, NF); NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); |