diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index 19eb965ea25..f56dc95cd1e 100644 --- a/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1116,7 +1116,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { // inserting cast instructions as necessary. std::vector Args; Args.reserve(NumActualArgs); - SmallVector attrVec; + SmallVector attrVec; attrVec.reserve(NumCommonArgs); // Get any return attributes. @@ -1128,9 +1128,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { // Add the new return attributes. if (RAttrs.hasAttributes()) - attrVec.push_back( - AttributeWithIndex::get(AttributeSet::ReturnIndex, - Attribute::get(FT->getContext(), RAttrs))); + attrVec.push_back(AttributeSet::get(Caller->getContext(), + AttributeSet::ReturnIndex, RAttrs)); AI = CS.arg_begin(); for (unsigned i = 0; i != NumCommonArgs; ++i, ++AI) { @@ -1146,9 +1145,8 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { // Add any parameter attributes. AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1); if (PAttrs.hasAttributes()) - attrVec.push_back( - AttributeWithIndex::get(i + 1, - Attribute::get(FT->getContext(), PAttrs))); + attrVec.push_back(AttributeSet::get(Caller->getContext(), i + 1, + PAttrs)); } // If the function takes more arguments than the call was taking, add them @@ -1175,18 +1173,15 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { // Add any parameter attributes. AttrBuilder PAttrs(CallerPAL.getParamAttributes(i + 1), i + 1); if (PAttrs.hasAttributes()) - attrVec.push_back( - AttributeWithIndex::get(i + 1, - Attribute::get(FT->getContext(), PAttrs))); + attrVec.push_back(AttributeSet::get(FT->getContext(), i + 1, + PAttrs)); } } } AttributeSet FnAttrs = CallerPAL.getFnAttributes(); if (CallerPAL.hasAttributes(AttributeSet::FunctionIndex)) - attrVec.push_back(AttributeWithIndex::get(Callee->getContext(), - AttributeSet::FunctionIndex, - FnAttrs)); + attrVec.push_back(AttributeSet::get(Callee->getContext(), FnAttrs)); if (NewRetTy->isVoidTy()) Caller->setName(""); // Void type should not have a name. @@ -1287,7 +1282,7 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS, std::vector NewArgs; NewArgs.reserve(unsigned(CS.arg_end()-CS.arg_begin())+1); - SmallVector NewAttrs; + SmallVector NewAttrs; NewAttrs.reserve(Attrs.getNumSlots() + 1); // Insert the nest argument into the call argument list, which may @@ -1295,9 +1290,8 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS, // Add any result attributes. if (Attrs.hasAttributes(AttributeSet::ReturnIndex)) - NewAttrs.push_back(AttributeWithIndex::get(Caller->getContext(), - AttributeSet::ReturnIndex, - Attrs.getRetAttributes())); + NewAttrs.push_back(AttributeSet::get(Caller->getContext(), + Attrs.getRetAttributes())); { unsigned Idx = 1; @@ -1309,8 +1303,8 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS, if (NestVal->getType() != NestTy) NestVal = Builder->CreateBitCast(NestVal, NestTy, "nest"); NewArgs.push_back(NestVal); - NewAttrs.push_back(AttributeWithIndex::get(Caller->getContext(), - NestIdx, NestAttr)); + NewAttrs.push_back(AttributeSet::get(Caller->getContext(), + NestAttr)); } if (I == E) @@ -1320,9 +1314,9 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS, NewArgs.push_back(*I); AttributeSet Attr = Attrs.getParamAttributes(Idx); if (Attr.hasAttributes(Idx)) { - NewAttrs.push_back - (AttributeWithIndex::get(Caller->getContext(), Idx, Attr)); - NewAttrs.back().Index = Idx + (Idx >= NestIdx); + AttrBuilder B(Attr, Idx); + NewAttrs.push_back(AttributeSet::get(Caller->getContext(), + Idx + (Idx >= NestIdx), B)); } ++Idx, ++I; @@ -1331,9 +1325,8 @@ InstCombiner::transformCallThroughTrampoline(CallSite CS, // Add any function attributes. if (Attrs.hasAttributes(AttributeSet::FunctionIndex)) - NewAttrs.push_back(AttributeWithIndex::get(FTy->getContext(), - AttributeSet::FunctionIndex, - Attrs.getFnAttributes())); + NewAttrs.push_back(AttributeSet::get(FTy->getContext(), + Attrs.getFnAttributes())); // The trampoline may have been bitcast to a bogus type (FTy). // Handle this by synthesizing a new function type, equal to FTy