[PATCH] D20195: [PGO] Add flags to control IRPGO warnings.
Jake VanAdrighem via llvm-commits
llvm-commits at lists.llvm.org
Wed May 11 21:27:43 PDT 2016
JakeVanAdrighem created this revision.
JakeVanAdrighem added reviewers: xur, davidxl, silvas.
JakeVanAdrighem added a subscriber: llvm-commits.
JakeVanAdrighem set the repository for this revision to rL LLVM.
Currently there is no reasonable way to control the warnings in the 'use' phase of the IRPGO pass. This is problematic because the output can be somewhat spammy. This patch adds some flags which allow us to optionally disable these warnings. The current upstream behavior will remain the default.
Repository:
rL LLVM
http://reviews.llvm.org/D20195
Files:
lib/Transforms/Instrumentation/PGOInstrumentation.cpp
Index: lib/Transforms/Instrumentation/PGOInstrumentation.cpp
===================================================================
--- lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -111,6 +111,16 @@
cl::desc("Max number of annotations for a single indirect "
"call callsite"));
+// Command line option to enable/disable the warning about missing profile
+// information.
+static cl::opt<bool> PGOWarnMissing("pgo-warn-missing", cl::init(true),
+ cl::Hidden);
+
+// Command line option to enable/disable the warning about a hash mismatch in
+// the profile data.
+static cl::opt<bool> PGOWarnMismatch("pgo-warn-mismatch", cl::init(true),
+ cl::Hidden);
+
namespace {
class PGOInstrumentationGenLegacyPass : public ModulePass {
public:
@@ -575,11 +585,17 @@
ErrorOr<InstrProfRecord> Result =
PGOReader->getInstrProfRecord(FuncInfo.FuncName, FuncInfo.FunctionHash);
if (std::error_code EC = Result.getError()) {
- if (EC == instrprof_error::unknown_function)
+ bool Warn = false;
+ if (PGOWarnMissing && EC == instrprof_error::unknown_function) {
NumOfPGOMissing++;
- else if (EC == instrprof_error::hash_mismatch ||
- EC == llvm::instrprof_error::malformed)
+ Warn = true;
+ } else if (PGOWarnMismatch && (EC == instrprof_error::hash_mismatch ||
+ EC == llvm::instrprof_error::malformed)) {
NumOfPGOMismatch++;
+ Warn = true;
+ }
+ if (!Warn)
+ return false;
std::string Msg = EC.message() + std::string(" ") + F.getName().str();
Ctx.diagnose(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20195.56983.patch
Type: text/x-patch
Size: 1725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160512/6cd1a98d/attachment.bin>
More information about the llvm-commits
mailing list