[PATCH] D107038: [Bitcode][Asm] Parse metadata value from operand bundles
Necip Fazil Yildiran via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 28 23:07:58 PDT 2021
necipfazil created this revision.
Herald added a subscriber: hiraditya.
necipfazil requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Support parsing operand bundles with metadata value from LLVM IR.
This is almost an NFC since there is no existing producers/consumers for
metadata operand bundle values, except the following call graph section
patches in revision:
Producer: https://reviews.llvm.org/D105909
Consumer: https://reviews.llvm.org/D105915
The test in this revision only ensures that the parser does not
complain. The above-mentioned patches implicity test if passed metadata
value is correct.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107038
Files:
llvm/lib/AsmParser/LLParser.cpp
llvm/test/Bitcode/2021-07-22-Parse-Metadata-Operand-Bundles.ll
Index: llvm/test/Bitcode/2021-07-22-Parse-Metadata-Operand-Bundles.ll
===================================================================
--- /dev/null
+++ llvm/test/Bitcode/2021-07-22-Parse-Metadata-Operand-Bundles.ll
@@ -0,0 +1,9 @@
+; This test ensures that we parse metadata operand bundle values.
+; RUN: llvm-as < %s
+
+declare void @callee()
+
+define void @call_with_operand_bundle() {
+ call void @callee() [ "op_type"(metadata !"metadata_string") ]
+ ret void
+}
Index: llvm/lib/AsmParser/LLParser.cpp
===================================================================
--- llvm/lib/AsmParser/LLParser.cpp
+++ llvm/lib/AsmParser/LLParser.cpp
@@ -2745,9 +2745,17 @@
return true;
Type *Ty = nullptr;
+ if (parseType(Ty))
+ return false;
+
Value *Input = nullptr;
- if (parseType(Ty) || parseValue(Ty, Input, PFS))
- return true;
+ if (Ty->isMetadataTy()) {
+ if (parseMetadataAsValue(Input, PFS))
+ return true;
+ } else {
+ if (parseValue(Ty, Input, PFS))
+ return true;
+ }
Inputs.push_back(Input);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107038.362649.patch
Type: text/x-patch
Size: 1123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210729/9a1cb302/attachment.bin>
More information about the llvm-commits
mailing list