Skip to content

[Bitcode][Asm] Parse metadata value from operand bundles #87570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions llvm/lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3201,9 +3201,22 @@ 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 [PR#89649](https://github.com/llvm/llvm-project/pull/89649)
// for the reproducers, and
// https://github.com/llvm/llvm-project/issues/50608 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);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; This test ensures that we parse metadata operand bundle values.
; RUN: llvm-as < %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No CHECK lines? is this just a test that llvm-as doesn't crash?


declare void @callee()

define void @call_with_operand_bundle() {
call void @callee() [ "op_type"(metadata !"metadata_string") ]
ret void
}
Loading