aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/AddReadAttrs.cpp4
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp44
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp62
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp12
-rw-r--r--lib/Transforms/IPO/InlineAlways.cpp2
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp2
-rw-r--r--lib/Transforms/IPO/Inliner.cpp2
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp2
-rw-r--r--lib/Transforms/IPO/PruneEH.cpp14
-rw-r--r--lib/Transforms/IPO/StructRetPromotion.cpp36
10 files changed, 90 insertions, 90 deletions
diff --git a/lib/Transforms/IPO/AddReadAttrs.cpp b/lib/Transforms/IPO/AddReadAttrs.cpp
index 8f7fd6e6a8..4e0677b0d8 100644
--- a/lib/Transforms/IPO/AddReadAttrs.cpp
+++ b/lib/Transforms/IPO/AddReadAttrs.cpp
@@ -105,10 +105,10 @@ bool AddReadAttrs::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
MadeChange = true;
// Clear out any existing attributes.
- F->removeParamAttr(0, ParamAttr::ReadOnly | ParamAttr::ReadNone);
+ F->removeAttribute(0, Attribute::ReadOnly | Attribute::ReadNone);
// Add in the new attribute.
- F->addParamAttr(0, ReadsMemory ? ParamAttr::ReadOnly : ParamAttr::ReadNone);
+ F->addAttribute(0, ReadsMemory ? Attribute::ReadOnly : Attribute::ReadNone);
if (ReadsMemory)
NumReadOnly++;
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index d71ed94f66..fe6583e4da 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -144,7 +144,7 @@ bool ArgPromotion::PromoteArguments(CallGraphNode *CGN) {
SmallPtrSet<Argument*, 8> ArgsToPromote;
SmallPtrSet<Argument*, 8> ByValArgsToTransform;
for (unsigned i = 0; i != PointerArgs.size(); ++i) {
- bool isByVal = F->paramHasAttr(PointerArgs[i].second+1, ParamAttr::ByVal);
+ bool isByVal = F->paramHasAttr(PointerArgs[i].second+1, Attribute::ByVal);
// If this is a byval argument, and if the aggregate type is small, just
// pass the elements, which is always safe.
@@ -501,15 +501,15 @@ Function *ArgPromotion::DoPromotion(Function *F,
// what the new GEP/Load instructions we are inserting look like.
std::map<IndicesVector, LoadInst*> OriginalLoads;
- // ParamAttrs - Keep track of the parameter attributes for the arguments
+ // Attributes - Keep track of the parameter attributes for the arguments
// that we are *not* promoting. For the ones that we do promote, the parameter
// attributes are lost
- SmallVector<FnAttributeWithIndex, 8> ParamAttrsVec;
- const PAListPtr &PAL = F->getParamAttrs();
+ SmallVector<AttributeWithIndex, 8> AttributesVec;
+ const AttrListPtr &PAL = F->getAttributes();
// Add any return attributes.
- if (Attributes attrs = PAL.getParamAttrs(0))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(0, attrs));
+ if (Attributes attrs = PAL.getAttributes(0))
+ AttributesVec.push_back(AttributeWithIndex::get(0, attrs));
// First, determine the new argument list
unsigned ArgIndex = 1;
@@ -525,8 +525,8 @@ Function *ArgPromotion::DoPromotion(Function *F,
} else if (!ArgsToPromote.count(I)) {
// Unchanged argument
Params.push_back(I->getType());
- if (Attributes attrs = PAL.getParamAttrs(ArgIndex))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(Params.size(), attrs));
+ if (Attributes attrs = PAL.getAttributes(ArgIndex))
+ AttributesVec.push_back(AttributeWithIndex::get(Params.size(), attrs));
} else if (I->use_empty()) {
// Dead argument (which are always marked as promotable)
++NumArgumentsDead;
@@ -597,8 +597,8 @@ Function *ArgPromotion::DoPromotion(Function *F,
// Recompute the parameter attributes list based on the new arguments for
// the function.
- NF->setParamAttrs(PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end()));
- ParamAttrsVec.clear();
+ NF->setAttributes(AttrListPtr::get(AttributesVec.begin(), AttributesVec.end()));
+ AttributesVec.clear();
F->getParent()->getFunctionList().insert(F, NF);
NF->takeName(F);
@@ -618,11 +618,11 @@ Function *ArgPromotion::DoPromotion(Function *F,
while (!F->use_empty()) {
CallSite CS = CallSite::get(F->use_back());
Instruction *Call = CS.getInstruction();
- const PAListPtr &CallPAL = CS.getParamAttrs();
+ const AttrListPtr &CallPAL = CS.getAttributes();
// Add any return attributes.
- if (Attributes attrs = CallPAL.getParamAttrs(0))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(0, attrs));
+ if (Attributes attrs = CallPAL.getAttributes(0))
+ AttributesVec.push_back(AttributeWithIndex::get(0, attrs));
// Loop over the operands, inserting GEP and loads in the caller as
// appropriate.
@@ -633,8 +633,8 @@ Function *ArgPromotion::DoPromotion(Function *F,
if (!ArgsToPromote.count(I) && !ByValArgsToTransform.count(I)) {
Args.push_back(*AI); // Unmodified argument
- if (Attributes Attrs = CallPAL.getParamAttrs(ArgIndex))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(Args.size(), Attrs));
+ if (Attributes Attrs = CallPAL.getAttributes(ArgIndex))
+ AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
} else if (ByValArgsToTransform.count(I)) {
// Emit a GEP and load for each element of the struct.
@@ -688,8 +688,8 @@ Function *ArgPromotion::DoPromotion(Function *F,
// Push any varargs arguments on the list
for (; AI != CS.arg_end(); ++AI, ++ArgIndex) {
Args.push_back(*AI);
- if (Attributes Attrs = CallPAL.getParamAttrs(ArgIndex))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(Args.size(), Attrs));
+ if (Attributes Attrs = CallPAL.getAttributes(ArgIndex))
+ AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
}
Instruction *New;
@@ -697,18 +697,18 @@ Function *ArgPromotion::DoPromotion(Function *F,
New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
Args.begin(), Args.end(), "", Call);
cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
- cast<InvokeInst>(New)->setParamAttrs(PAListPtr::get(ParamAttrsVec.begin(),
- ParamAttrsVec.end()));
+ cast<InvokeInst>(New)->setAttributes(AttrListPtr::get(AttributesVec.begin(),
+ AttributesVec.end()));
} else {
New = CallInst::Create(NF, Args.begin(), Args.end(), "", Call);
cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
- cast<CallInst>(New)->setParamAttrs(PAListPtr::get(ParamAttrsVec.begin(),
- ParamAttrsVec.end()));
+ cast<CallInst>(New)->setAttributes(AttrListPtr::get(AttributesVec.begin(),
+ AttributesVec.end()));
if (cast<CallInst>(Call)->isTailCall())
cast<CallInst>(New)->setTailCall();
}
Args.clear();
- ParamAttrsVec.clear();
+ AttributesVec.clear();
// Update the alias analysis implementation to know that we are replacing
// the old call with a new one.
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index ab3321d756..eef326b758 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -224,12 +224,12 @@ bool DAE::DeleteDeadVarargs(Function &Fn) {
Args.assign(CS.arg_begin(), CS.arg_begin()+NumArgs);
// Drop any attributes that were on the vararg arguments.
- PAListPtr PAL = CS.getParamAttrs();
+ AttrListPtr PAL = CS.getAttributes();
if (!PAL.isEmpty() && PAL.getSlot(PAL.getNumSlots() - 1).Index > NumArgs) {
- SmallVector<FnAttributeWithIndex, 8> ParamAttrsVec;
+ SmallVector<AttributeWithIndex, 8> AttributesVec;
for (unsigned i = 0; PAL.getSlot(i).Index <= NumArgs; ++i)
- ParamAttrsVec.push_back(PAL.getSlot(i));
- PAL = PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end());
+ AttributesVec.push_back(PAL.getSlot(i));
+ PAL = AttrListPtr::get(AttributesVec.begin(), AttributesVec.end());
}
Instruction *New;
@@ -237,11 +237,11 @@ bool DAE::DeleteDeadVarargs(Function &Fn) {
New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
Args.begin(), Args.end(), "", Call);
cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
- cast<InvokeInst>(New)->setParamAttrs(PAL);
+ cast<InvokeInst>(New)->setAttributes(PAL);
} else {
New = CallInst::Create(NF, Args.begin(), Args.end(), "", Call);
cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
- cast<CallInst>(New)->setParamAttrs(PAL);
+ cast<CallInst>(New)->setAttributes(PAL);
if (cast<CallInst>(Call)->isTailCall())
cast<CallInst>(New)->setTailCall();
}
@@ -589,11 +589,11 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
std::vector<const Type*> Params;
// Set up to build a new list of parameter attributes.
- SmallVector<FnAttributeWithIndex, 8> ParamAttrsVec;
- const PAListPtr &PAL = F->getParamAttrs();
+ SmallVector<AttributeWithIndex, 8> AttributesVec;
+ const AttrListPtr &PAL = F->getAttributes();
// The existing function return attributes.
- Attributes RAttrs = PAL.getParamAttrs(0);
+ Attributes RAttrs = PAL.getAttributes(0);
// Find out the new return value.
@@ -655,13 +655,13 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
// here. Currently, this should not be possible, but special handling might be
// required when new return value attributes are added.
if (NRetTy == Type::VoidTy)
- RAttrs &= ~ParamAttr::typeIncompatible(NRetTy);
+ RAttrs &= ~Attribute::typeIncompatible(NRetTy);
else
- assert((RAttrs & ParamAttr::typeIncompatible(NRetTy)) == 0
+ assert((RAttrs & Attribute::typeIncompatible(NRetTy)) == 0
&& "Return attributes no longer compatible?");
if (RAttrs)
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(0, RAttrs));
+ AttributesVec.push_back(AttributeWithIndex::get(0, RAttrs));
// Remember which arguments are still alive.
SmallVector<bool, 10> ArgAlive(FTy->getNumParams(), false);
@@ -678,8 +678,8 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
// Get the original parameter attributes (skipping the first one, that is
// for the return value.
- if (Attributes Attrs = PAL.getParamAttrs(i + 1))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(Params.size(), Attrs));
+ if (Attributes Attrs = PAL.getAttributes(i + 1))
+ AttributesVec.push_back(AttributeWithIndex::get(Params.size(), Attrs));
} else {
++NumArgumentsEliminated;
DOUT << "DAE - Removing argument " << i << " (" << I->getNameStart()
@@ -687,8 +687,8 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
}
}
- // Reconstruct the ParamAttrsList based on the vector we constructed.
- PAListPtr NewPAL = PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end());
+ // Reconstruct the AttributesList based on the vector we constructed.
+ AttrListPtr NewPAL = AttrListPtr::get(AttributesVec.begin(), AttributesVec.end());
// Work around LLVM bug PR56: the CWriter cannot emit varargs functions which
// have zero fixed arguments.
@@ -712,7 +712,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
// Create the new function body and insert it into the module...
Function *NF = Function::Create(NFTy, F->getLinkage());
NF->copyAttributesFrom(F);
- NF->setParamAttrs(NewPAL);
+ NF->setAttributes(NewPAL);
// Insert the new function before the old function, so we won't be processing
// it again.
F->getParent()->getFunctionList().insert(F, NF);
@@ -726,15 +726,15 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
CallSite CS = CallSite::get(F->use_back());
Instruction *Call = CS.getInstruction();
- ParamAttrsVec.clear();
- const PAListPtr &CallPAL = CS.getParamAttrs();
+ AttributesVec.clear();
+ const AttrListPtr &CallPAL = CS.getAttributes();
// The call return attributes.
- Attributes RAttrs = CallPAL.getParamAttrs(0);
+ Attributes RAttrs = CallPAL.getAttributes(0);
// Adjust in case the function was changed to return void.
- RAttrs &= ~ParamAttr::typeIncompatible(NF->getReturnType());
+ RAttrs &= ~Attribute::typeIncompatible(NF->getReturnType());
if (RAttrs)
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(0, RAttrs));
+ AttributesVec.push_back(AttributeWithIndex::get(0, RAttrs));
// Declare these outside of the loops, so we can reuse them for the second
// loop, which loops the varargs.
@@ -746,8 +746,8 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
if (ArgAlive[i]) {
Args.push_back(*I);
// Get original parameter attributes, but skip return attributes.
- if (Attributes Attrs = CallPAL.getParamAttrs(i + 1))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(Args.size(), Attrs));
+ if (Attributes Attrs = CallPAL.getAttributes(i + 1))
+ AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
}
if (ExtraArgHack)
@@ -756,24 +756,24 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
// Push any varargs arguments on the list. Don't forget their attributes.
for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) {
Args.push_back(*I);
- if (Attributes Attrs = CallPAL.getParamAttrs(i + 1))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(Args.size(), Attrs));
+ if (Attributes Attrs = CallPAL.getAttributes(i + 1))
+ AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
}
- // Reconstruct the ParamAttrsList based on the vector we constructed.
- PAListPtr NewCallPAL = PAListPtr::get(ParamAttrsVec.begin(),
- ParamAttrsVec.end());
+ // Reconstruct the AttributesList based on the vector we constructed.
+ AttrListPtr NewCallPAL = AttrListPtr::get(AttributesVec.begin(),
+ AttributesVec.end());
Instruction *New;
if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
Args.begin(), Args.end(), "", Call);
cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
- cast<InvokeInst>(New)->setParamAttrs(NewCallPAL);
+ cast<InvokeInst>(New)->setAttributes(NewCallPAL);
} else {
New = CallInst::Create(NF, Args.begin(), Args.end(), "", Call);
cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
- cast<CallInst>(New)->setParamAttrs(NewCallPAL);
+ cast<CallInst>(New)->setAttributes(NewCallPAL);
if (cast<CallInst>(Call)->isTailCall())
cast<CallInst>(New)->setTailCall();
}
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 0c059ff014..31f214441f 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -1627,23 +1627,23 @@ static void ChangeCalleesToFastCall(Function *F) {
}
}
-static PAListPtr StripNest(const PAListPtr &Attrs) {
+static AttrListPtr StripNest(const AttrListPtr &Attrs) {
for (unsigned i = 0, e = Attrs.getNumSlots(); i != e; ++i) {
- if ((Attrs.getSlot(i).Attrs & ParamAttr::Nest) == 0)
+ if ((Attrs.getSlot(i).Attrs & Attribute::Nest) == 0)
continue;
// There can be only one.
- return Attrs.removeAttr(Attrs.getSlot(i).Index, ParamAttr::Nest);
+ return Attrs.removeAttr(Attrs.getSlot(i).Index, Attribute::Nest);
}
return Attrs;
}
static void RemoveNestAttribute(Function *F) {
- F->setParamAttrs(StripNest(F->getParamAttrs()));
+ F->setAttributes(StripNest(F->getAttributes()));
for (Value::use_iterator UI = F->use_begin(), E = F->use_end(); UI != E;++UI){
CallSite User(cast<Instruction>(*UI));
- User.setParamAttrs(StripNest(User.getParamAttrs()));
+ User.setAttributes(StripNest(User.getAttributes()));
}
}
@@ -1670,7 +1670,7 @@ bool GlobalOpt::OptimizeFunctions(Module &M) {
Changed = true;
}
- if (F->getParamAttrs().hasAttrSomewhere(ParamAttr::Nest) &&
+ if (F->getAttributes().hasAttrSomewhere(Attribute::Nest) &&
OnlyCalledDirectly(F)) {
// The function is not used by a trampoline intrinsic, so it is safe
// to remove the 'nest' attribute.
diff --git a/lib/Transforms/IPO/InlineAlways.cpp b/lib/Transforms/IPO/InlineAlways.cpp
index 6d95ffd2d5..448f246141 100644
--- a/lib/Transforms/IPO/InlineAlways.cpp
+++ b/lib/Transforms/IPO/InlineAlways.cpp
@@ -63,7 +63,7 @@ bool AlwaysInliner::doInitialization(CallGraph &CG) {
for (Module::iterator I = M.begin(), E = M.end();
I != E; ++I)
- if (!I->isDeclaration() && !I->hasNote(FnAttr::AlwaysInline))
+ if (!I->isDeclaration() && !I->hasNote(Attribute::AlwaysInline))
NeverInline.insert(I);
return false;
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 1cf6c9ec6c..b19494a6a4 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -65,7 +65,7 @@ bool SimpleInliner::doInitialization(CallGraph &CG) {
for (Module::iterator I = M.begin(), E = M.end();
I != E; ++I)
- if (!I->isDeclaration() && I->hasNote(FnAttr::NoInline))
+ if (!I->isDeclaration() && I->hasNote(Attribute::NoInline))
NeverInline.insert(I);
// Get llvm.noinline
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 5718835995..abc1094414 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -141,7 +141,7 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
int CurrentThreshold = InlineThreshold;
Function *Fn = CS.getCaller();
- if (Fn && !Fn->isDeclaration() && Fn->hasNote(FnAttr::OptimizeForSize)
+ if (Fn && !Fn->isDeclaration() && Fn->hasNote(Attribute::OptimizeForSize)
&& InlineThreshold != 50) {
CurrentThreshold = 50;
}
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp
index d5997fb4b5..dfc040b833 100644
--- a/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -474,7 +474,7 @@ void LowerSetJmp::visitCallInst(CallInst& CI)
InvokeInst::Create(CI.getCalledValue(), NewBB, PrelimBBMap[Func],
Params.begin(), Params.end(), CI.getName(), Term);
II->setCallingConv(CI.getCallingConv());
- II->setParamAttrs(CI.getParamAttrs());
+ II->setAttributes(CI.getAttributes());
// Replace the old call inst with the invoke inst and remove the call.
CI.replaceAllUsesWith(II);
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp
index 9968d59451..821e7d5da9 100644
--- a/lib/Transforms/IPO/PruneEH.cpp
+++ b/lib/Transforms/IPO/PruneEH.cpp
@@ -125,18 +125,18 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
// If the SCC doesn't unwind or doesn't throw, note this fact.
if (!SCCMightUnwind || !SCCMightReturn)
for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
- Attributes NewAttributes = ParamAttr::None;
+ Attributes NewAttributes = Attribute::None;
if (!SCCMightUnwind)
- NewAttributes |= ParamAttr::NoUnwind;
+ NewAttributes |= Attribute::NoUnwind;
if (!SCCMightReturn)
- NewAttributes |= ParamAttr::NoReturn;
+ NewAttributes |= Attribute::NoReturn;
- const PAListPtr &PAL = SCC[i]->getFunction()->getParamAttrs();
- const PAListPtr &NPAL = PAL.addAttr(0, NewAttributes);
+ const AttrListPtr &PAL = SCC[i]->getFunction()->getAttributes();
+ const AttrListPtr &NPAL = PAL.addAttr(0, NewAttributes);
if (PAL != NPAL) {
MadeChange = true;
- SCC[i]->getFunction()->setParamAttrs(NPAL);
+ SCC[i]->getFunction()->setAttributes(NPAL);
}
}
@@ -169,7 +169,7 @@ bool PruneEH::SimplifyFunction(Function *F) {
Args.begin(), Args.end(), "", II);
Call->takeName(II);
Call->setCallingConv(II->getCallingConv());
- Call->setParamAttrs(II->getParamAttrs());
+ Call->setAttributes(II->getAttributes());
// Anything that used the value produced by the invoke instruction
// now uses the value produced by the call instruction.
diff --git a/lib/Transforms/IPO/StructRetPromotion.cpp b/lib/Transforms/IPO/StructRetPromotion.cpp
index 69aecc3e57..07b9e504c7 100644
--- a/lib/Transforms/IPO/StructRetPromotion.cpp
+++ b/lib/Transforms/IPO/StructRetPromotion.cpp
@@ -205,13 +205,13 @@ Function *SRETPromotion::cloneFunctionBody(Function *F,
const FunctionType *FTy = F->getFunctionType();
std::vector<const Type*> Params;
- // ParamAttrs - Keep track of the parameter attributes for the arguments.
- SmallVector<FnAttributeWithIndex, 8> ParamAttrsVec;
- const PAListPtr &PAL = F->getParamAttrs();
+ // Attributes - Keep track of the parameter attributes for the arguments.
+ SmallVector<AttributeWithIndex, 8> AttributesVec;
+ const AttrListPtr &PAL = F->getAttributes();
// Add any return attributes.
- if (Attributes attrs = PAL.getParamAttrs(0))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(0, attrs));
+ if (Attributes attrs = PAL.getAttributes(0))
+ AttributesVec.push_back(AttributeWithIndex::get(0, attrs));
// Skip first argument.
Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
@@ -221,8 +221,8 @@ Function *SRETPromotion::cloneFunctionBody(Function *F,
unsigned ParamIndex = 2;
while (I != E) {
Params.push_back(I->getType());
- if (Attributes Attrs = PAL.getParamAttrs(ParamIndex))
- ParamAttrsVec.push_back(FnAttributeWithIndex::get(ParamIndex - 1, Attrs));
+ if (Attributes Attrs = PAL.getAttributes(ParamIndex))
+ AttributesVec.push_back(AttributeWithIndex::get(ParamIndex - 1, Attrs));
++I;
++ParamIndex;
}
@@ -231,7 +231,7 @@ Function *SRETPromotion::cloneFunctionBody(Function *F,
Function *NF = Function::Create(NFTy, F->getLinkage());
NF->takeName(F);
NF->copyAttributesFrom(F);
- NF->setParamAttrs(PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end()));
+ NF->setAttributes(AttrListPtr::get(AttributesVec.begin(), AttributesVec.end()));
F->getParent()->getFunctionList().insert(F, NF);
NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList());
@@ -255,17 +255,17 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) {
CallGraph &CG = getAnalysis<CallGraph>();
SmallVector<Value*, 16> Args;
- // ParamAttrs - Keep track of the parameter attributes for the arguments.
- SmallVector<FnAttributeWithIndex, 8> ArgAttrsVec;
+ // Attributes - Keep track of the parameter attributes for the arguments.
+ SmallVector<AttributeWithIndex, 8> ArgAttrsVec;
while (!F->use_empty()) {
CallSite CS = CallSite::get(*F->use_begin());
Instruction *Call = CS.getInstruction();
- const PAListPtr &PAL = F->getParamAttrs();
+ const AttrListPtr &PAL = F->getAttributes();
// Add any return attributes.
- if (Attributes attrs = PAL.getParamAttrs(0))
- ArgAttrsVec.push_back(FnAttributeWithIndex::get(0, attrs));
+ if (Attributes attrs = PAL.getAttributes(0))
+ ArgAttrsVec.push_back(AttributeWithIndex::get(0, attrs));
// Copy arguments, however skip first one.
CallSite::arg_iterator AI = CS.arg_begin(), AE = CS.arg_end();
@@ -276,14 +276,14 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) {
unsigned ParamIndex = 2;
while (AI != AE) {
Args.push_back(*AI);
- if (Attributes Attrs = PAL.getParamAttrs(ParamIndex))
- ArgAttrsVec.push_back(FnAttributeWithIndex::get(ParamIndex - 1, Attrs));
+ if (Attributes Attrs = PAL.getAttributes(ParamIndex))
+ ArgAttrsVec.push_back(AttributeWithIndex::get(ParamIndex - 1, Attrs));
++ParamIndex;
++AI;
}
- PAListPtr NewPAL = PAListPtr::get(ArgAttrsVec.begin(), ArgAttrsVec.end());
+ AttrListPtr NewPAL = AttrListPtr::get(ArgAttrsVec.begin(), ArgAttrsVec.end());
// Build new call instruction.
Instruction *New;
@@ -291,11 +291,11 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) {
New = InvokeInst::Create(NF, II->getNormalDest(), II->getUnwindDest(),
Args.begin(), Args.end(), "", Call);
cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
- cast<InvokeInst>(New)->setParamAttrs(NewPAL);
+ cast<InvokeInst>(New)->setAttributes(NewPAL);
} else {
New = CallInst::Create(NF, Args.begin(), Args.end(), "", Call);
cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
- cast<CallInst>(New)->setParamAttrs(NewPAL);
+ cast<CallInst>(New)->setAttributes(NewPAL);
if (cast<CallInst>(Call)->isTailCall())
cast<CallInst>(New)->setTailCall();
}