From: Derek Schuff Date: Wed, 12 Apr 2017 16:03:00 +0000 (+0000) Subject: [WebAssembly] Update use of Attributes after r299875 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=490024c934135d06c878b6546fb1c5e15179b95f;p=llvm [WebAssembly] Update use of Attributes after r299875 This fixes the failing WebAssemblyLowerEmscriptenEHSjLj tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300072 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp index 16e7ffa58c0..e1b2f79c81c 100644 --- a/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp +++ b/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp @@ -435,26 +435,23 @@ Value *WebAssemblyLowerEmscriptenEHSjLj::wrapInvoke(CallOrInvoke *CI) { // Because we added the pointer to the callee as first argument, all // argument attribute indices have to be incremented by one. - SmallVector AttributesVec; - const AttributeList &InvokePAL = CI->getAttributes(); - CallSite::arg_iterator AI = CI->arg_begin(); - unsigned i = 1; // Argument attribute index starts from 1 - for (unsigned e = CI->getNumArgOperands(); i <= e; ++AI, ++i) { - if (InvokePAL.hasAttributes(i)) { - AttrBuilder B(InvokePAL, i); - AttributesVec.push_back(AttributeList::get(C, i + 1, B)); - } - } + SmallVector AttributesVec; + const AttributeList &InvokeAL = CI->getAttributes(); + // Add any return attributes. - if (InvokePAL.hasAttributes(AttributeList::ReturnIndex)) - AttributesVec.push_back( - AttributeList::get(C, InvokePAL.getRetAttributes())); + AttributesVec.push_back(InvokeAL.getRetAttributes()); + // No attributes for the callee pointer. + AttributesVec.push_back(AttributeSet()); + // Copy the argument attributes from the original + for (unsigned i = 1, e = CI->getNumArgOperands(); i <= e; ++i) { + AttributesVec.push_back(InvokeAL.getParamAttributes(i)); + } + // Add any function attributes. - if (InvokePAL.hasAttributes(AttributeList::FunctionIndex)) - AttributesVec.push_back(AttributeList::get(C, InvokePAL.getFnAttributes())); + AttributesVec.push_back(InvokeAL.getFnAttributes()); // Reconstruct the AttributesList based on the vector we constructed. - AttributeList NewCallPAL = AttributeList::get(C, AttributesVec); - NewCall->setAttributes(NewCallPAL); + AttributeList NewCallAL = AttributeList::get(C, AttributesVec); + NewCall->setAttributes(NewCallAL); CI->replaceAllUsesWith(NewCall);