[PATCH] D20195: [PGO] Add flags to control IRPGO warnings.

Jake VanAdrighem via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 16:50:15 PDT 2016


JakeVanAdrighem updated this revision to Diff 57117.
JakeVanAdrighem added a comment.

The meaning/name of the flags have been changed so that we only pass them to disable the warnings. The flags also no longer interfere with the statistics.


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> NoPGOWarnMissing("no-pgo-warn-missing", cl::init(false),
+                                    cl::Hidden);
+
+// Command line option to enable/disable the warning about a hash mismatch in
+// the profile data.
+static cl::opt<bool> NoPGOWarnMismatch("no-pgo-warn-mismatch", cl::init(false),
+                                     cl::Hidden);
+
 namespace {
 class PGOInstrumentationGenLegacyPass : public ModulePass {
 public:
@@ -575,11 +585,16 @@
   ErrorOr<InstrProfRecord> Result =
       PGOReader->getInstrProfRecord(FuncInfo.FuncName, FuncInfo.FunctionHash);
   if (std::error_code EC = Result.getError()) {
-    if (EC == instrprof_error::unknown_function)
+    if (EC == instrprof_error::unknown_function) {
       NumOfPGOMissing++;
-    else if (EC == instrprof_error::hash_mismatch ||
-             EC == llvm::instrprof_error::malformed)
+      if (NoPGOWarnMissing)
+        return false;
+    } else if (EC == instrprof_error::hash_mismatch ||
+               EC == llvm::instrprof_error::malformed) {
       NumOfPGOMismatch++;
+      if (NoPGOWarnMismatch)
+        return false;
+    }
 
     std::string Msg = EC.message() + std::string(" ") + F.getName().str();
     Ctx.diagnose(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20195.57117.patch
Type: text/x-patch
Size: 1682 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160512/a882b4d7/attachment.bin>


More information about the llvm-commits mailing list