[PATCH] D107913: [PGO] Make negative pgo-warn-mismatch{,-comdat} options positive`-pgo-warn-mismatch=false` replaces `-no-pgo-warn-mismatch=false`.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 11 09:58:39 PDT 2021


MaskRay created this revision.
MaskRay added a reviewer: xur.
Herald added subscribers: ormris, wenlei, steven_wu, hiraditya.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107913

Files:
  llvm/lib/LTO/LTOBackend.cpp
  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
@@ -201,21 +201,18 @@
 namespace llvm {
 // Command line option to enable/disable the warning about a hash mismatch in
 // the profile data.
-cl::opt<bool>
-    NoPGOWarnMismatch("no-pgo-warn-mismatch", cl::init(false), cl::Hidden,
-                      cl::desc("Use this option to turn off/on "
-                               "warnings about profile cfg mismatch."));
+cl::opt<bool> PGOWarnMismatch("pgo-warn-mismatch", cl::init(true), cl::Hidden,
+                              cl::desc("Warn about profile cfg mismatch"));
 } // namespace llvm
 
 // 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."));
+    PGOWarnMismatchComdat("pgo-warn-mismatch-comdat", cl::init(false),
+                          cl::Hidden,
+                          cl::desc("Warn about hash mismatch for comdat "
+                                   "functions"));
 
 // Command line option to enable/disable select instruction instrumentation.
 static cl::opt<bool>
@@ -1293,8 +1290,8 @@
                  Err == instrprof_error::malformed) {
         IsCS ? NumOfCSPGOMismatch++ : NumOfPGOMismatch++;
         SkipWarning =
-            NoPGOWarnMismatch ||
-            (NoPGOWarnMismatchComdat &&
+            !PGOWarnMismatch ||
+            (!PGOWarnMismatchComdat &&
              (F.hasComdat() ||
               F.getLinkage() == GlobalValue::AvailableExternallyLinkage));
         LLVM_DEBUG(dbgs() << "hash mismatch (skip=" << SkipWarning << ")");
Index: llvm/lib/LTO/LTOBackend.cpp
===================================================================
--- llvm/lib/LTO/LTOBackend.cpp
+++ llvm/lib/LTO/LTOBackend.cpp
@@ -75,7 +75,7 @@
              "importing and the other pre-optimization pipeline changes."));
 
 namespace llvm {
-extern cl::opt<bool> NoPGOWarnMismatch;
+extern cl::opt<bool> PGOWarnMismatch;
 }
 
 [[noreturn]] static void reportOpenError(StringRef Path, Twine Msg) {
@@ -225,7 +225,7 @@
     PGOOpt = PGOOptions(Conf.CSIRProfile, "", Conf.ProfileRemapping,
                         PGOOptions::IRUse, PGOOptions::CSIRUse,
                         Conf.AddFSDiscriminator);
-    NoPGOWarnMismatch = !Conf.PGOWarnMismatch;
+    PGOWarnMismatch = Conf.PGOWarnMismatch;
   } else if (Conf.AddFSDiscriminator) {
     PGOOpt = PGOOptions("", "", "", PGOOptions::NoAction,
                         PGOOptions::NoCSAction, true);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107913.365785.patch
Type: text/x-patch
Size: 3094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210811/2c656b30/attachment.bin>


More information about the llvm-commits mailing list