diff options
author | Mircea Trofin <mtrofin@google.com> | 2025-06-25 13:10:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-25 13:10:43 -0700 |
commit | 62f8281e0842c9cefc847e1e22ec559a1a36f017 (patch) | |
tree | 1abc677d9d28da63f487816d925098af31bf8a30 /llvm/lib/IR/Verifier.cpp | |
parent | fcbfff193e96037aa8131af91cefee2888d3de72 (diff) | |
download | llvm-62f8281e0842c9cefc847e1e22ec559a1a36f017.zip llvm-62f8281e0842c9cefc847e1e22ec559a1a36f017.tar.gz llvm-62f8281e0842c9cefc847e1e22ec559a1a36f017.tar.bz2 |
[IR][PGO] Verify invalid `MD_prof` metadata on instructions (#145576)
This PR places the validation of `MD_prof` instruction metadata in the Verifier.
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 3e53ade..e7bb6d9 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -5026,6 +5026,9 @@ void Verifier::visitProfMetadata(Instruction &I, MDNode *MD) { Check(mdconst::dyn_extract<ConstantInt>(MDO), "!prof brunch_weights operand is not a const int"); } + } else { + Check(ProfName == "VP", "expected either branch_weights or VP profile name", + MD); } } |