[PATCH] D105138: [OpaquePtr][BitcodeWriter] Handle attributes with types

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 14:10:00 PDT 2021


aeubanks updated this revision to Diff 355362.
aeubanks added a comment.

only enumerate type attributes once


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105138/new/

https://reviews.llvm.org/D105138

Files:
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
  llvm/test/Assembler/opaque-ptr.ll


Index: llvm/test/Assembler/opaque-ptr.ll
===================================================================
--- llvm/test/Assembler/opaque-ptr.ll
+++ llvm/test/Assembler/opaque-ptr.ll
@@ -134,3 +134,8 @@
     cleanup
   ret void
 }
+
+; CHECK: define void @byval(ptr byval({ i32, i32 }) %0)
+define void @byval(ptr byval({ i32, i32 }) %0) {
+  ret void
+}
Index: llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
===================================================================
--- llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -1045,6 +1045,11 @@
     if (Entry == 0) {
       AttributeGroups.push_back(Pair);
       Entry = AttributeGroups.size();
+
+      for (Attribute Attr : AS) {
+        if (Attr.isTypeAttribute())
+          EnumerateType(Attr.getValueAsType());
+      }
     }
   }
 }
Index: llvm/lib/Bitcode/Reader/BitcodeReader.cpp
===================================================================
--- llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3333,6 +3333,9 @@
       if (!Func->hasParamAttribute(i, Kind))
         continue;
 
+      if (Func->getParamAttribute(i, Kind).getValueAsType())
+        continue;
+
       Func->removeParamAttr(i, Kind);
 
       Type *PTy = cast<FunctionType>(FTy)->getParamType(i);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105138.355362.patch
Type: text/x-patch
Size: 1327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210629/e1f18ee7/attachment.bin>


More information about the llvm-commits mailing list