aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorMircea Trofin <mtrofin@google.com>2025-09-04 13:15:23 -0700
committerGitHub <noreply@github.com>2025-09-04 13:15:23 -0700
commit2a99532b8913e4f4a7777d04d56ed0729d3838f9 (patch)
tree19faaeb4b3078f0ed03eb7e6aa5f9a7586800089 /llvm/lib/IR/Verifier.cpp
parent119d507afcb6d8d1546e1b1fc9dbaf22c319851e (diff)
downloadllvm-2a99532b8913e4f4a7777d04d56ed0729d3838f9.zip
llvm-2a99532b8913e4f4a7777d04d56ed0729d3838f9.tar.gz
llvm-2a99532b8913e4f4a7777d04d56ed0729d3838f9.tar.bz2
[profcheck] Allow `unknown` function entry count (#155918)
Some passes synthesize functions, e.g. WPD, so we may need to indicate “this synthesized function’s entry count cannot be estimated at compile time” - akin to `branch_weights`​. Issue #147390
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index b285150..4e71a67 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2529,12 +2529,11 @@ void Verifier::verifyFunctionMetadata(
for (const auto &Pair : MDs) {
if (Pair.first == LLVMContext::MD_prof) {
MDNode *MD = Pair.second;
- if (isExplicitlyUnknownBranchWeightsMetadata(*MD)) {
- CheckFailed("'unknown' !prof metadata should appear only on "
- "instructions supporting the 'branch_weights' metadata",
- MD);
+ // We may have functions that are synthesized by the compiler, e.g. in
+ // WPD, that we can't currently determine the entry count.
+ if (isExplicitlyUnknownProfileMetadata(*MD))
continue;
- }
+
Check(MD->getNumOperands() >= 2,
"!prof annotations should have no less than 2 operands", MD);