[PATCH] D129002: [PGO] Improve hash-mismatch warning message
Rong Xu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 15 13:55:18 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG19ac75364fc9: [PGO] Improve hash-mismatch warning message (authored by xur).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129002/new/
https://reviews.llvm.org/D129002
Files:
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
Index: llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -210,12 +210,11 @@
// Command line option to enable/disable the warning about a hash mismatch in
// the profile data for Comdat functions, which often turns out to be false
// positive due to the pre-instrumentation inline.
-static cl::opt<bool>
- NoPGOWarnMismatchComdat("no-pgo-warn-mismatch-comdat", cl::init(true),
- cl::Hidden,
- cl::desc("The option is used to turn on/off "
- "warnings about hash mismatch for comdat "
- "functions."));
+static cl::opt<bool> NoPGOWarnMismatchComdatWeak(
+ "no-pgo-warn-mismatch-comdat-weak", cl::init(true), cl::Hidden,
+ cl::desc("The option is used to turn on/off "
+ "warnings about hash mismatch for comdat "
+ "or weak functions."));
// Command line option to enable/disable select instruction instrumentation.
static cl::opt<bool>
@@ -287,6 +286,11 @@
cl::desc("Set the threshold for pgo-verify-bfi: skip the counts whose "
"profile count value is below."));
+static cl::opt<std::string> PGOTraceFuncHash(
+ "pgo-trace-func-hash", cl::init("-"), cl::Hidden,
+ cl::value_desc("function name"),
+ cl::desc("Trace the hash of the function with this name."));
+
namespace llvm {
// Command line option to turn on CFG dot dump after profile annotation.
// Defined in Analysis/BlockFrequencyInfo.cpp: -pgo-view-counts
@@ -630,6 +634,10 @@
<< ", High32 CRC = " << JCH.getCRC());
}
LLVM_DEBUG(dbgs() << ", Hash = " << FunctionHash << "\n";);
+
+ if (PGOTraceFuncHash != "-" && F.getName().contains(PGOTraceFuncHash))
+ dbgs() << "Funcname=" << F.getName() << ", Hash=" << FunctionHash
+ << " in building " << F.getParent()->getSourceFileName() << "\n";
}
// Check if we can safely rename this Comdat function.
@@ -1233,10 +1241,11 @@
IsCS ? NumOfCSPGOMismatch++ : NumOfPGOMismatch++;
SkipWarning =
NoPGOWarnMismatch ||
- (NoPGOWarnMismatchComdat &&
- (F.hasComdat() ||
+ (NoPGOWarnMismatchComdatWeak &&
+ (F.hasComdat() || F.getLinkage() == GlobalValue::WeakAnyLinkage ||
F.getLinkage() == GlobalValue::AvailableExternallyLinkage));
- LLVM_DEBUG(dbgs() << "hash mismatch (skip=" << SkipWarning << ")");
+ LLVM_DEBUG(dbgs() << "hash mismatch (hash= " << FuncInfo.FunctionHash
+ << " skip=" << SkipWarning << ")");
// Emit function metadata indicating PGO profile mismatch.
annotateFunctionWithHashMismatch(F, M->getContext());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129002.445122.patch
Type: text/x-patch
Size: 2933 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220715/ed5c3161/attachment.bin>
More information about the llvm-commits
mailing list