[llvm] r300015 - [WebAssembly] Update use of Attributes after r299875

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 18:09:34 PDT 2017


Author: dschuff
Date: Tue Apr 11 20:09:34 2017
New Revision: 300015

URL: http://llvm.org/viewvc/llvm-project?rev=300015&view=rev
Log:
[WebAssembly] Update use of Attributes after r299875

This fixes the failing WebAssemblyLowerEmscriptenEHSjLj tests

Modified:
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp?rev=300015&r1=300014&r2=300015&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp Tue Apr 11 20:09:34 2017
@@ -435,26 +435,23 @@ Value *WebAssemblyLowerEmscriptenEHSjLj:
 
   // 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);
 




More information about the llvm-commits mailing list