<div dir="ltr">I think this broke the clang build.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Fri, Apr 28, 2017 at 2:48 PM, Reid Kleckner via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rnk<br>
Date: Fri Apr 28 16:48:28 2017<br>
New Revision: 301697<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=301697&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=301697&view=rev</a><br>
Log:<br>
[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList<br>
<br>
This change cleans up call sites and avoids creating temporary<br>
AttributeList objects.<br>
<br>
NFC<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/<wbr>CodeGen/CommandFlags.h<br>
llvm/trunk/include/llvm/IR/<wbr>Attributes.h<br>
llvm/trunk/include/llvm/IR/<wbr>Function.h<br>
llvm/trunk/lib/CodeGen/<wbr>GlobalISel/CallLowering.cpp<br>
llvm/trunk/lib/IR/Attributes.<wbr>cpp<br>
llvm/trunk/lib/IR/Function.cpp<br>
llvm/trunk/lib/Target/Mips/<wbr>Mips16HardFloat.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Coroutines/CoroSplit.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>DataFlowSanitizer.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>MemorySanitizer.cpp<br>
llvm/trunk/lib/Transforms/<wbr>Scalar/<wbr>RewriteStatepointsForGC.cpp<br>
llvm/trunk/unittests/IR/<wbr>AttributesTest.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/<wbr>CodeGen/CommandFlags.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CommandFlags.h?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/CodeGen/CommandFlags.h?<wbr>rev=301697&r1=301696&r2=<wbr>301697&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/<wbr>CodeGen/CommandFlags.h (original)<br>
+++ llvm/trunk/include/llvm/<wbr>CodeGen/CommandFlags.h Fri Apr 28 16:48:28 2017<br>
@@ -346,29 +346,21 @@ static inline void setFunctionAttributes<br>
Module &M) {<br>
for (auto &F : M) {<br>
auto &Ctx = F.getContext();<br>
- AttributeList Attrs = F.getAttributes(), NewAttrs;<br>
+ AttributeList Attrs = F.getAttributes();<br>
+ AttrBuilder NewAttrs;<br>
<br>
if (!CPU.empty())<br>
- NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,<br>
- "target-cpu", CPU);<br>
-<br>
+ NewAttrs.addAttribute("target-<wbr>cpu", CPU);<br>
if (!Features.empty())<br>
- NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,<br>
- "target-features", Features);<br>
-<br>
+ NewAttrs.addAttribute("target-<wbr>features", Features);<br>
if (DisableFPElim.<wbr>getNumOccurrences() > 0)<br>
- NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,<br>
- "no-frame-pointer-elim",<br>
- DisableFPElim ? "true" : "false");<br>
-<br>
+ NewAttrs.addAttribute("no-<wbr>frame-pointer-elim",<br>
+ DisableFPElim ? "true" : "false");<br>
if (DisableTailCalls.<wbr>getNumOccurrences() > 0)<br>
- NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,<br>
- "disable-tail-calls",<br>
- toStringRef(DisableTailCalls))<wbr>;<br>
-<br>
+ NewAttrs.addAttribute("<wbr>disable-tail-calls",<br>
+ toStringRef(DisableTailCalls))<wbr>;<br>
if (StackRealign)<br>
- NewAttrs = NewAttrs.addAttribute(Ctx, AttributeList::FunctionIndex,<br>
- "stackrealign");<br>
+ NewAttrs.addAttribute("<wbr>stackrealign");<br>
<br>
if (TrapFuncName.<wbr>getNumOccurrences() > 0)<br>
for (auto &B : F)<br>
@@ -382,8 +374,8 @@ static inline void setFunctionAttributes<br>
Attribute::get(Ctx, "trap-func-name", TrapFuncName));<br>
<br>
// Let NewAttrs override Attrs.<br>
- NewAttrs = Attrs.addAttributes(Ctx, AttributeList::FunctionIndex, NewAttrs);<br>
- F.setAttributes(NewAttrs);<br>
+ F.setAttributes(<br>
+ Attrs.addAttributes(Ctx, AttributeList::FunctionIndex, NewAttrs));<br>
}<br>
}<br>
<br>
<br>
Modified: llvm/trunk/include/llvm/IR/<wbr>Attributes.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/IR/Attributes.h?rev=<wbr>301697&r1=301696&r2=301697&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/IR/<wbr>Attributes.h (original)<br>
+++ llvm/trunk/include/llvm/IR/<wbr>Attributes.h Fri Apr 28 16:48:28 2017<br>
@@ -354,9 +354,6 @@ public:<br>
/// \brief Add attributes to the attribute set at the given index. Because<br>
/// attribute sets are immutable, this returns a new set.<br>
AttributeList addAttributes(LLVMContext &C, unsigned Index,<br>
- AttributeList Attrs) const;<br>
-<br>
- AttributeList addAttributes(LLVMContext &C, unsigned Index,<br>
const AttrBuilder &B) const;<br>
<br>
/// \brief Remove the specified attribute at the specified index from this<br>
@@ -375,13 +372,7 @@ public:<br>
/// attribute list. Because attribute lists are immutable, this returns the<br>
/// new list.<br>
AttributeList removeAttributes(LLVMContext &C, unsigned Index,<br>
- AttributeList Attrs) const;<br>
-<br>
- /// \brief Remove the specified attributes at the specified index from this<br>
- /// attribute list. Because attribute lists are immutable, this returns the<br>
- /// new list.<br>
- AttributeList removeAttributes(LLVMContext &C, unsigned Index,<br>
- const AttrBuilder &Attrs) const;<br>
+ const AttrBuilder &AttrsToRemove) const;<br>
<br>
/// \brief Remove all attributes at the specified index from this<br>
/// attribute list. Because attribute lists are immutable, this returns the<br>
<br>
Modified: llvm/trunk/include/llvm/IR/<wbr>Function.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Function.h?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/IR/Function.h?rev=301697&<wbr>r1=301696&r2=301697&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/IR/<wbr>Function.h (original)<br>
+++ llvm/trunk/include/llvm/IR/<wbr>Function.h Fri Apr 28 16:48:28 2017<br>
@@ -279,7 +279,7 @@ public:<br>
void addAttribute(unsigned i, Attribute Attr);<br>
<br>
/// @brief adds the attributes to the list of attributes.<br>
- void addAttributes(unsigned i, AttributeList Attrs);<br>
+ void addAttributes(unsigned i, const AttrBuilder &Attrs);<br>
<br>
/// @brief removes the attribute from the list of attributes.<br>
void removeAttribute(unsigned i, Attribute::AttrKind Kind);<br>
@@ -288,7 +288,7 @@ public:<br>
void removeAttribute(unsigned i, StringRef Kind);<br>
<br>
/// @brief removes the attributes from the list of attributes.<br>
- void removeAttributes(unsigned i, AttributeList Attrs);<br>
+ void removeAttributes(unsigned i, const AttrBuilder &Attrs);<br>
<br>
/// @brief check if an attributes is in the list of attributes.<br>
bool hasAttribute(unsigned i, Attribute::AttrKind Kind) const {<br>
<br>
Modified: llvm/trunk/lib/CodeGen/<wbr>GlobalISel/CallLowering.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/CallLowering.cpp?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>CodeGen/GlobalISel/<wbr>CallLowering.cpp?rev=301697&<wbr>r1=301696&r2=301697&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/CodeGen/<wbr>GlobalISel/CallLowering.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/<wbr>GlobalISel/CallLowering.cpp Fri Apr 28 16:48:28 2017<br>
@@ -83,8 +83,8 @@ void CallLowering::setArgFlags(<wbr>CallLower<br>
// For ByVal, alignment should be passed from FE. BE will guess if<br>
// this info is not there but there are cases it cannot get right.<br>
unsigned FrameAlign;<br>
- if (FuncInfo.getParamAlignment(<wbr>OpIdx - 1))<br>
- FrameAlign = FuncInfo.getParamAlignment(<wbr>OpIdx - 1);<br>
+ if (FuncInfo.getParamAlignment(<wbr>OpIdx - 2))<br>
+ FrameAlign = FuncInfo.getParamAlignment(<wbr>OpIdx - 2);<br>
else<br>
FrameAlign = getTLI()-><wbr>getByValTypeAlignment(<wbr>ElementTy, DL);<br>
Arg.Flags.setByValAlign(<wbr>FrameAlign);<br>
<br>
Modified: llvm/trunk/lib/IR/Attributes.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/IR/<wbr>Attributes.cpp?rev=301697&r1=<wbr>301696&r2=301697&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/IR/Attributes.<wbr>cpp (original)<br>
+++ llvm/trunk/lib/IR/Attributes.<wbr>cpp Fri Apr 28 16:48:28 2017<br>
@@ -936,7 +936,9 @@ AttributeList AttributeList::get(LLVMCon<br>
AttributeList AttributeList::addAttribute(<wbr>LLVMContext &C, unsigned Index,<br>
Attribute::AttrKind Kind) const {<br>
if (hasAttribute(Index, Kind)) return *this;<br>
- return addAttributes(C, Index, AttributeList::get(C, Index, Kind));<br>
+ AttrBuilder B;<br>
+ B.addAttribute(Kind);<br>
+ return addAttributes(C, Index, B);<br>
}<br>
<br>
AttributeList AttributeList::addAttribute(<wbr>LLVMContext &C, unsigned Index,<br>
@@ -944,7 +946,7 @@ AttributeList AttributeList::addAttribut<br>
StringRef Value) const {<br>
AttrBuilder B;<br>
B.addAttribute(Kind, Value);<br>
- return addAttributes(C, Index, AttributeList::get(C, Index, B));<br>
+ return addAttributes(C, Index, B);<br>
}<br>
<br>
AttributeList AttributeList::addAttribute(<wbr>LLVMContext &C,<br>
@@ -978,14 +980,6 @@ AttributeList AttributeList::addAttribut<br>
}<br>
<br>
AttributeList AttributeList::addAttributes(<wbr>LLVMContext &C, unsigned Index,<br>
- AttributeList Attrs) const {<br>
- if (!pImpl) return Attrs;<br>
- if (!Attrs.pImpl) return *this;<br>
-<br>
- return addAttributes(C, Index, Attrs.getAttributes(Index));<br>
-}<br>
-<br>
-AttributeList AttributeList::addAttributes(<wbr>LLVMContext &C, unsigned Index,<br>
const AttrBuilder &B) const {<br>
if (!B.hasAttributes())<br>
return *this;<br>
@@ -1034,18 +1028,17 @@ AttributeList AttributeList::addAttribut<br>
AttributeList AttributeList::<wbr>removeAttribute(LLVMContext &C, unsigned Index,<br>
Attribute::AttrKind Kind) const {<br>
if (!hasAttribute(Index, Kind)) return *this;<br>
- return removeAttributes(C, Index, AttributeList::get(C, Index, Kind));<br>
+ AttrBuilder B;<br>
+ B.addAttribute(Kind);<br>
+ return removeAttributes(C, Index, B);<br>
}<br>
<br>
AttributeList AttributeList::<wbr>removeAttribute(LLVMContext &C, unsigned Index,<br>
StringRef Kind) const {<br>
if (!hasAttribute(Index, Kind)) return *this;<br>
- return removeAttributes(C, Index, AttributeList::get(C, Index, Kind));<br>
-}<br>
-<br>
-AttributeList AttributeList::<wbr>removeAttributes(LLVMContext &C, unsigned Index,<br>
- AttributeList Attrs) const {<br>
- return removeAttributes(C, Index, AttrBuilder(Attrs.<wbr>getAttributes(Index)));<br>
+ AttrBuilder B;<br>
+ B.addAttribute(Kind);<br>
+ return removeAttributes(C, Index, B);<br>
}<br>
<br>
AttributeList AttributeList::<wbr>removeAttributes(LLVMContext &C, unsigned Index,<br>
@@ -1103,7 +1096,7 @@ AttributeList AttributeList::addDerefere<br>
uint64_t Bytes) const {<br>
AttrBuilder B;<br>
B.addDereferenceableAttr(<wbr>Bytes);<br>
- return addAttributes(C, Index, AttributeList::get(C, Index, B));<br>
+ return addAttributes(C, Index, B);<br>
}<br>
<br>
AttributeList<br>
@@ -1111,7 +1104,7 @@ AttributeList::<wbr>addDereferenceableOrNullA<br>
uint64_t Bytes) const {<br>
AttrBuilder B;<br>
B.<wbr>addDereferenceableOrNullAttr(<wbr>Bytes);<br>
- return addAttributes(C, Index, AttributeList::get(C, Index, B));<br>
+ return addAttributes(C, Index, B);<br>
}<br>
<br>
AttributeList<br>
@@ -1120,7 +1113,7 @@ AttributeList::<wbr>addAllocSizeAttr(LLVMCont<br>
const Optional<unsigned> &NumElemsArg) {<br>
AttrBuilder B;<br>
B.addAllocSizeAttr(<wbr>ElemSizeArg, NumElemsArg);<br>
- return addAttributes(C, Index, AttributeList::get(C, Index, B));<br>
+ return addAttributes(C, Index, B);<br>
}<br>
<br>
//===-------------------------<wbr>------------------------------<wbr>---------------===//<br>
@@ -1610,12 +1603,10 @@ static void adjustCallerSSPLevel(Functio<br>
// If upgrading the SSP attribute, clear out the old SSP Attributes first.<br>
// Having multiple SSP attributes doesn't actually hurt, but it adds useless<br>
// clutter to the IR.<br>
- AttrBuilder B;<br>
- B.addAttribute(Attribute::<wbr>StackProtect)<br>
- .addAttribute(Attribute::<wbr>StackProtectStrong)<br>
- .addAttribute(Attribute::<wbr>StackProtectReq);<br>
- AttributeList OldSSPAttr =<br>
- AttributeList::get(Caller.<wbr>getContext(), AttributeList::FunctionIndex, B);<br>
+ AttrBuilder OldSSPAttr;<br>
+ OldSSPAttr.addAttribute(<wbr>Attribute::StackProtect)<br>
+ .addAttribute(Attribute::<wbr>StackProtectStrong)<br>
+ .addAttribute(Attribute::<wbr>StackProtectReq);<br>
<br>
if (Callee.hasFnAttribute(<wbr>Attribute::StackProtectReq)) {<br>
Caller.removeAttributes(<wbr>AttributeList::FunctionIndex, OldSSPAttr);<br>
<br>
Modified: llvm/trunk/lib/IR/Function.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Function.cpp?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/IR/<wbr>Function.cpp?rev=301697&r1=<wbr>301696&r2=301697&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/IR/Function.cpp (original)<br>
+++ llvm/trunk/lib/IR/Function.cpp Fri Apr 28 16:48:28 2017<br>
@@ -328,7 +328,7 @@ void Function::addAttribute(<wbr>unsigned i,<br>
setAttributes(PAL);<br>
}<br>
<br>
-void Function::addAttributes(<wbr>unsigned i, AttributeList Attrs) {<br>
+void Function::addAttributes(<wbr>unsigned i, const AttrBuilder &Attrs) {<br>
AttributeList PAL = getAttributes();<br>
PAL = PAL.addAttributes(getContext()<wbr>, i, Attrs);<br>
setAttributes(PAL);<br>
@@ -346,7 +346,7 @@ void Function::removeAttribute(<wbr>unsigned<br>
setAttributes(PAL);<br>
}<br>
<br>
-void Function::removeAttributes(<wbr>unsigned i, AttributeList Attrs) {<br>
+void Function::removeAttributes(<wbr>unsigned i, const AttrBuilder &Attrs) {<br>
AttributeList PAL = getAttributes();<br>
PAL = PAL.removeAttributes(<wbr>getContext(), i, Attrs);<br>
setAttributes(PAL);<br>
<br>
Modified: llvm/trunk/lib/Target/Mips/<wbr>Mips16HardFloat.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips16HardFloat.cpp?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/Target/<wbr>Mips/Mips16HardFloat.cpp?rev=<wbr>301697&r1=301696&r2=301697&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Target/Mips/<wbr>Mips16HardFloat.cpp (original)<br>
+++ llvm/trunk/lib/Target/Mips/<wbr>Mips16HardFloat.cpp Fri Apr 28 16:48:28 2017<br>
@@ -490,15 +490,14 @@ static void createFPFnStub(Function *F,<br>
// remove the use-soft-float attribute<br>
//<br>
static void removeUseSoftFloat(Function &F) {<br>
- AttributeList A;<br>
+ AttrBuilder B;<br>
DEBUG(errs() << "removing -use-soft-float\n");<br>
- A = A.addAttribute(F.getContext(), AttributeList::FunctionIndex,<br>
- "use-soft-float", "false");<br>
- F.removeAttributes(<wbr>AttributeList::FunctionIndex, A);<br>
+ B.addAttribute("use-soft-<wbr>float", "false");<br>
+ F.removeAttributes(<wbr>AttributeList::FunctionIndex, B);<br>
if (F.hasFnAttribute("use-soft-<wbr>float")) {<br>
DEBUG(errs() << "still has -use-soft-float\n");<br>
}<br>
- F.addAttributes(AttributeList:<wbr>:FunctionIndex, A);<br>
+ F.addAttributes(AttributeList:<wbr>:FunctionIndex, B);<br>
}<br>
<br>
<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Coroutines/CoroSplit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Coroutines/<wbr>CoroSplit.cpp?rev=301697&r1=<wbr>301696&r2=301697&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Coroutines/CoroSplit.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Coroutines/CoroSplit.cpp Fri Apr 28 16:48:28 2017<br>
@@ -245,9 +245,7 @@ static Function *createClone(Function &F<br>
// Remove old return attributes.<br>
NewF->removeAttributes(<br>
AttributeList::ReturnIndex,<br>
- AttributeList::get(<br>
- NewF->getContext(), AttributeList::ReturnIndex,<br>
- AttributeFuncs::<wbr>typeIncompatible(NewF-><wbr>getReturnType())));<br>
+ AttributeFuncs::<wbr>typeIncompatible(NewF-><wbr>getReturnType()));<br>
<br>
// Make AllocaSpillBlock the new entry block.<br>
auto *SwitchBB = cast<BasicBlock>(VMap[<wbr>ResumeEntry]);<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>DataFlowSanitizer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Instrumentation/<wbr>DataFlowSanitizer.cpp?rev=<wbr>301697&r1=301696&r2=301697&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>DataFlowSanitizer.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>DataFlowSanitizer.cpp Fri Apr 28 16:48:28 2017<br>
@@ -254,7 +254,7 @@ class DataFlowSanitizer : public ModuleP<br>
MDNode *ColdCallWeights;<br>
DFSanABIList ABIList;<br>
DenseMap<Value *, Function *> UnwrappedFnMap;<br>
- AttributeList ReadOnlyNoneAttrs;<br>
+ AttrBuilder ReadOnlyNoneAttrs;<br>
bool DFSanRuntimeShadowMask;<br>
<br>
Value *getShadowAddress(Value *Addr, Instruction *Pos);<br>
@@ -544,16 +544,12 @@ DataFlowSanitizer::<wbr>buildWrapperFunction(<br>
NewF->copyAttributesFrom(F);<br>
NewF->removeAttributes(<br>
AttributeList::ReturnIndex,<br>
- AttributeList::get(<br>
- F->getContext(), AttributeList::ReturnIndex,<br>
- AttributeFuncs::<wbr>typeIncompatible(NewFT-><wbr>getReturnType())));<br>
+ AttributeFuncs::<wbr>typeIncompatible(NewFT-><wbr>getReturnType()));<br>
<br>
BasicBlock *BB = BasicBlock::Create(*Ctx, "entry", NewF);<br>
if (F->isVarArg()) {<br>
- NewF->removeAttributes(<br>
- AttributeList::FunctionIndex,<br>
- AttributeList().addAttribute(*<wbr>Ctx, AttributeList::FunctionIndex,<br>
- "split-stack"));<br>
+ NewF->removeAttributes(<wbr>AttributeList::FunctionIndex,<br>
+ AttrBuilder().addAttribute("<wbr>split-stack"));<br>
CallInst::Create(<wbr>DFSanVarargWrapperFn,<br>
IRBuilder<>(BB).<wbr>CreateGlobalStringPtr(F-><wbr>getName()), "",<br>
BB);<br>
@@ -698,9 +694,8 @@ bool DataFlowSanitizer::<wbr>runOnModule(Modu<br>
}<br>
}<br>
<br>
- AttrBuilder B;<br>
- B.addAttribute(Attribute::<wbr>ReadOnly).addAttribute(<wbr>Attribute::ReadNone);<br>
- ReadOnlyNoneAttrs = AttributeList::get(*Ctx, AttributeList::FunctionIndex, B);<br>
+ ReadOnlyNoneAttrs.<wbr>addAttribute(Attribute::<wbr>ReadOnly)<br>
+ .addAttribute(Attribute::<wbr>ReadNone);<br>
<br>
// First, change the ABI of every function in the module. ABI-listed<br>
// functions keep their original ABI and get a wrapper function.<br>
@@ -722,9 +717,7 @@ bool DataFlowSanitizer::<wbr>runOnModule(Modu<br>
NewF->copyAttributesFrom(&F);<br>
NewF->removeAttributes(<br>
AttributeList::ReturnIndex,<br>
- AttributeList::get(<br>
- NewF->getContext(), AttributeList::ReturnIndex,<br>
- AttributeFuncs::<wbr>typeIncompatible(NewFT-><wbr>getReturnType())));<br>
+ AttributeFuncs::<wbr>typeIncompatible(NewFT-><wbr>getReturnType()));<br>
for (Function::arg_iterator FArg = F.arg_begin(),<br>
NewFArg = NewF->arg_begin(),<br>
FArgEnd = F.arg_end();<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>MemorySanitizer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Instrumentation/<wbr>MemorySanitizer.cpp?rev=<wbr>301697&r1=301696&r2=301697&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>MemorySanitizer.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Instrumentation/<wbr>MemorySanitizer.cpp Fri Apr 28 16:48:28 2017<br>
@@ -2607,10 +2607,7 @@ struct MemorySanitizerVisitor : public I<br>
AttrBuilder B;<br>
B.addAttribute(Attribute::<wbr>ReadOnly)<br>
.addAttribute(Attribute::<wbr>ReadNone);<br>
- Func->removeAttributes(<wbr>AttributeList::FunctionIndex,<br>
- AttributeList::get(Func-><wbr>getContext(),<br>
- AttributeList::FunctionIndex,<br>
- B));<br>
+ Func->removeAttributes(<wbr>AttributeList::FunctionIndex, B);<br>
}<br>
<br>
maybeMarkSanitizerLibraryCallN<wbr>oBuiltin(Call, TLI);<br>
@@ -3659,9 +3656,7 @@ bool MemorySanitizer::<wbr>runOnFunction(Func<br>
AttrBuilder B;<br>
B.addAttribute(Attribute::<wbr>ReadOnly)<br>
.addAttribute(Attribute::<wbr>ReadNone);<br>
- F.removeAttributes(<br>
- AttributeList::FunctionIndex,<br>
- AttributeList::get(F.<wbr>getContext(), AttributeList::FunctionIndex, B));<br>
+ F.removeAttributes(<wbr>AttributeList::FunctionIndex, B);<br>
<br>
return Visitor.runOnFunction();<br>
}<br>
<br>
Modified: llvm/trunk/lib/Transforms/<wbr>Scalar/<wbr>RewriteStatepointsForGC.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Scalar/<wbr>RewriteStatepointsForGC.cpp?<wbr>rev=301697&r1=301696&r2=<wbr>301697&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/<wbr>Scalar/<wbr>RewriteStatepointsForGC.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/<wbr>Scalar/<wbr>RewriteStatepointsForGC.cpp Fri Apr 28 16:48:28 2017<br>
@@ -2290,8 +2290,7 @@ static void RemoveNonValidAttrAtIndex(LL<br>
R.addAttribute(Attribute::<wbr>NoAlias);<br>
<br>
if (!R.empty())<br>
- AH.setAttributes(AH.<wbr>getAttributes().<wbr>removeAttributes(<br>
- Ctx, Index, AttributeList::get(Ctx, Index, R)));<br>
+ AH.setAttributes(AH.<wbr>getAttributes().<wbr>removeAttributes(Ctx, Index, R));<br>
}<br>
<br>
void<br>
<br>
Modified: llvm/trunk/unittests/IR/<wbr>AttributesTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/AttributesTest.cpp?rev=301697&r1=301696&r2=301697&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/unittests/<wbr>IR/AttributesTest.cpp?rev=<wbr>301697&r1=301696&r2=301697&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/unittests/IR/<wbr>AttributesTest.cpp (original)<br>
+++ llvm/trunk/unittests/IR/<wbr>AttributesTest.cpp Fri Apr 28 16:48:28 2017<br>
@@ -45,7 +45,7 @@ TEST(Attributes, Ordering) {<br>
AttributeList::get(C, 1, Attribute::SExt)};<br>
<br>
AttributeList SetA = AttributeList::get(C, ASs);<br>
- AttributeList SetB = SetA.removeAttributes(C, 1, ASs[1]);<br>
+ AttributeList SetB = SetA.removeAttributes(C, 1, ASs[1].getAttributes(1));<br>
EXPECT_NE(SetA, SetB);<br>
}<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>