diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/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); } 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 --- /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 +}