[PATCH] D105138: [OpaquePtr][BitcodeWriter] Handle attributes with types
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 29 11:45:31 PDT 2021
aeubanks created this revision.
Herald added a subscriber: hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
For example, byval.
Skip the type attribute auto-upgrade if we already have the type.
I've actually seen this error of the ValueEnumerator missing a type
attribute's type in a non-opaque pointer context.
Repository:
rG LLVM Github Monorepo
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
@@ -1046,6 +1046,10 @@
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,10 @@
if (!Func->hasParamAttribute(i, Kind))
continue;
+ if (Func->getParamByValType(i) || Func->getParamInAllocaType(i) ||
+ Func->getParamStructRetType(i))
+ continue;
+
Func->removeParamAttr(i, Kind);
Type *PTy = cast<FunctionType>(FTy)->getParamType(i);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105138.355313.patch
Type: text/x-patch
Size: 1352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210629/b4d23c6f/attachment.bin>
More information about the llvm-commits
mailing list