[llvm] [InstrProf] Do not block functions from PGOUse (PR #71106)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 2 13:29:27 PDT 2023
https://github.com/ellishg created https://github.com/llvm/llvm-project/pull/71106
The `skipPGO()` function was added in https://reviews.llvm.org/D137184. Unfortunately, it also blocked functions from being annotated (PGOUse), which I believe will cause confusion to users if a function has a profile but it is not PGO'd.
The docs for `noprofile` and `skipprofile` only claim to block instrumentation, not PGO optimization: https://llvm.org/docs/LangRef.html
>From 859771d2fc9f38e5fd4a278175ca773a743ec8b1 Mon Sep 17 00:00:00 2001
From: Ellis Hoag <ellis.sparky.hoag at gmail.com>
Date: Thu, 2 Nov 2023 13:10:03 -0700
Subject: [PATCH] [InstrProf] Do not block functions from PGOUse
The `skipPGO()` function was added in https://reviews.llvm.org/D137184
Unfortunately, it also blocked functions from being annotated (PGOUse),
which I believe will cause confusion to users if a function has a
profile but it is not PGO'd.
The docs for `noprofile` and `skipprofile` only claim to block
instrumentation, not PGO optimization: https://llvm.org/docs/LangRef.html
---
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 7ad1c9bc54f3780..1474ccc2b978fd8 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -1760,7 +1760,7 @@ static void collectComdatMembers(
ComdatMembers.insert(std::make_pair(C, &GA));
}
-// Don't perform PGO instrumeatnion / profile-use.
+// Return true if we should skip instrumenting this function
static bool skipPGO(const Function &F) {
if (F.isDeclaration())
return true;
@@ -2031,7 +2031,7 @@ static bool annotateAllFunctions(
InstrumentFuncEntry = PGOInstrumentEntry;
bool HasSingleByteCoverage = PGOReader->hasSingleByteCoverage();
for (auto &F : M) {
- if (skipPGO(F))
+ if (F.isDeclaration())
continue;
auto &TLI = LookupTLI(F);
auto *BPI = LookupBPI(F);
More information about the llvm-commits
mailing list