Index: llvm/include/llvm/AsmParser/LLParser.h =================================================================== --- llvm/include/llvm/AsmParser/LLParser.h +++ llvm/include/llvm/AsmParser/LLParser.h @@ -55,6 +55,7 @@ t_LocalName, t_GlobalName, // Name in StrVal. t_APSInt, t_APFloat, // Value in APSIntVal/APFloatVal. t_Null, t_Undef, t_Zero, t_None, t_Poison, // No value. + t_UnknownProvenance, // No value. t_EmptyArray, // No value: [] t_Constant, // Value in ConstantVal. t_InlineAsm, // Value in FTy/StrVal/StrVal2/UIntVal. Index: llvm/include/llvm/AsmParser/LLToken.h =================================================================== --- llvm/include/llvm/AsmParser/LLToken.h +++ llvm/include/llvm/AsmParser/LLToken.h @@ -90,6 +90,7 @@ kw_unwind, kw_datalayout, kw_volatile, + kw_unknown_provenance, kw_atomic, kw_unordered, kw_monotonic, Index: llvm/lib/AsmParser/LLLexer.cpp =================================================================== --- llvm/lib/AsmParser/LLLexer.cpp +++ llvm/lib/AsmParser/LLLexer.cpp @@ -545,6 +545,7 @@ KEYWORD(unwind); KEYWORD(datalayout); KEYWORD(volatile); + KEYWORD(unknown_provenance); KEYWORD(atomic); KEYWORD(unordered); KEYWORD(monotonic); Index: llvm/lib/AsmParser/LLParser.cpp =================================================================== --- llvm/lib/AsmParser/LLParser.cpp +++ llvm/lib/AsmParser/LLParser.cpp @@ -3447,6 +3447,7 @@ break; case lltok::kw_null: ID.Kind = ValID::t_Null; break; case lltok::kw_undef: ID.Kind = ValID::t_Undef; break; + case lltok::kw_unknown_provenance: ID.Kind = ValID::t_UnknownProvenance; break; case lltok::kw_poison: ID.Kind = ValID::t_Poison; break; case lltok::kw_zeroinitializer: ID.Kind = ValID::t_Zero; break; case lltok::kw_none: ID.Kind = ValID::t_None; break; @@ -5742,6 +5743,11 @@ return error(ID.Loc, "invalid type for undef constant"); V = UndefValue::get(Ty); return false; + case ValID::t_UnknownProvenance: + if (!Ty->isPointerTy()) + return error(ID.Loc, "unknown_provenance must be a pointer type"); + V = UnknownProvenance::get(cast(Ty)); + return false; case ValID::t_EmptyArray: if (!Ty->isArrayTy() || cast(Ty)->getNumElements() != 0) return error(ID.Loc, "invalid empty array initializer"); @@ -5823,6 +5829,9 @@ case ValID::t_Null: C = Constant::getNullValue(Ty); return false; + case ValID::t_UnknownProvenance: + C = Constant::getUnknownProvenance(Ty); + return false; default: return error(Loc, "expected a constant value"); } Index: llvm/lib/IR/AsmWriter.cpp =================================================================== --- llvm/lib/IR/AsmWriter.cpp +++ llvm/lib/IR/AsmWriter.cpp @@ -1585,6 +1585,11 @@ return; } + if (isa(CV)) { + Out << "unknown_provenance"; + return; + } + if (const ConstantExpr *CE = dyn_cast(CV)) { Out << CE->getOpcodeName(); WriteOptimizationInfo(Out, CE);