[llvm] [Bitcode][Asm] Parse metadata value from operand bundles (PR #87570)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 17:00:16 PST 2024
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/87570
>From ca67025353a2b8f7d846e5a9cd82af9ccc2d1ed2 Mon Sep 17 00:00:00 2001
From: Necip Fazil Yildiran <necip at google.com>
Date: Wed, 3 Apr 2024 15:47:38 -0700
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
=?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.6-beta.1
---
llvm/lib/AsmParser/LLParser.cpp | 16 ++++++++++++++--
.../2021-07-22-Parse-Metadata-Operand-Bundles.ll | 9 +++++++++
2 files changed, 23 insertions(+), 2 deletions(-)
create mode 100644 llvm/test/Bitcode/2021-07-22-Parse-Metadata-Operand-Bundles.ll
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index fe49e52ae4283c..abd8a586ba2b55 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -3091,9 +3091,21 @@ bool LLParser::parseOptionalOperandBundles(
return true;
Type *Ty = nullptr;
- Value *Input = nullptr;
- if (parseType(Ty) || parseValue(Ty, Input, PFS))
+ if (parseType(Ty))
return true;
+
+ Value *Input = nullptr;
+ // FIXME: Metadata operand bundle value is garbage when LLVM IR is
+ // compiled to bitcode, then disassembled back to LLVM IR. See D107039
+ // for the reproducers, and https://bugs.llvm.org/show_bug.cgi?id=51264
+ // for the bug report.
+ if (Ty->isMetadataTy()) {
+ if (parseMetadataAsValue(Input, PFS))
+ return true;
+ } else {
+ if (parseValue(Ty, Input, PFS))
+ return true;
+ }
Inputs.push_back(Input);
}
diff --git a/llvm/test/Bitcode/2021-07-22-Parse-Metadata-Operand-Bundles.ll b/llvm/test/Bitcode/2021-07-22-Parse-Metadata-Operand-Bundles.ll
new file mode 100644
index 00000000000000..35c6131bbad60b
--- /dev/null
+++ b/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
+}
>From 8d214f0df7f9dc7a3a1f72193b3af5f7f84153c3 Mon Sep 17 00:00:00 2001
From: Necip Fazil Yildiran <necip at google.com>
Date: Mon, 22 Apr 2024 11:31:56 -0700
Subject: [PATCH 2/2] Updated fixme
Created using spr 1.3.6-beta.1
---
llvm/lib/AsmParser/LLParser.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index abd8a586ba2b55..ed68fbe806ee22 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -3096,7 +3096,7 @@ bool LLParser::parseOptionalOperandBundles(
Value *Input = nullptr;
// FIXME: Metadata operand bundle value is garbage when LLVM IR is
- // compiled to bitcode, then disassembled back to LLVM IR. See D107039
+ // compiled to bitcode, then disassembled back to LLVM IR. See PR#89649
// for the reproducers, and https://bugs.llvm.org/show_bug.cgi?id=51264
// for the bug report.
if (Ty->isMetadataTy()) {
More information about the llvm-commits
mailing list