diff options
author | Derek Schuff <dschuff@google.com> | 2017-04-12 01:09:34 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2017-04-12 01:09:34 +0000 |
commit | 857a7e5473471eded8bef7c81010bf09eac8d2a8 (patch) | |
tree | a31f4acf30cf0407750c7966c43a17dc19c5a66f | |
parent | c2cb5600450b8c4e5fdd915bd8c848319c5e57e1 (diff) | |
download | bcm5719-llvm-857a7e5473471eded8bef7c81010bf09eac8d2a8.tar.gz bcm5719-llvm-857a7e5473471eded8bef7c81010bf09eac8d2a8.zip |
[WebAssembly] Update use of Attributes after r299875
This fixes the failing WebAssemblyLowerEmscriptenEHSjLj tests
llvm-svn: 300015
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp index 16e7ffa58c0..08e2707bb97 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp +++ b/llvm/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<AttributeList, 8> 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<AttributeSetNode *, 8> 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(nullptr); + // 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); |