diff options
author | Derek Schuff <dschuff@google.com> | 2017-04-12 01:17:31 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2017-04-12 01:17:31 +0000 |
commit | 821637aa52a31dc3ad8aed15eb2760adb5e49774 (patch) | |
tree | 621b8f69c41b1b0aead20855cdede8ddd54eae70 | |
parent | 857a7e5473471eded8bef7c81010bf09eac8d2a8 (diff) | |
download | bcm5719-llvm-821637aa52a31dc3ad8aed15eb2760adb5e49774.tar.gz bcm5719-llvm-821637aa52a31dc3ad8aed15eb2760adb5e49774.zip |
Revert "[WebAssembly] Update use of Attributes after r299875"
This reverts commit 2a0eb61dcccb15058d5b2a572bb3da0cf47fd550, r300015
I raced with rnk on the commit.
llvm-svn: 300016
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp index 08e2707bb97..16e7ffa58c0 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp @@ -435,23 +435,26 @@ 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<AttributeSetNode *, 8> AttributesVec; - const AttributeList &InvokeAL = CI->getAttributes(); - - // Add any return attributes. - 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)); + 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)); + } } - + // Add any return attributes. + if (InvokePAL.hasAttributes(AttributeList::ReturnIndex)) + AttributesVec.push_back( + AttributeList::get(C, InvokePAL.getRetAttributes())); // Add any function attributes. - AttributesVec.push_back(InvokeAL.getFnAttributes()); + if (InvokePAL.hasAttributes(AttributeList::FunctionIndex)) + AttributesVec.push_back(AttributeList::get(C, InvokePAL.getFnAttributes())); // Reconstruct the AttributesList based on the vector we constructed. - AttributeList NewCallAL = AttributeList::get(C, AttributesVec); - NewCall->setAttributes(NewCallAL); + AttributeList NewCallPAL = AttributeList::get(C, AttributesVec); + NewCall->setAttributes(NewCallPAL); CI->replaceAllUsesWith(NewCall); |