[lld] 6c48098 - Revert "[lld] Add lto-pgo-warn-mismatch option"

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 11 01:25:57 PDT 2021


Author: Wang, Pengfei
Date: 2021-08-11T16:25:42+08:00
New Revision: 6c4809825dcce24d63c59aed0d2992d383ebd86d

URL: https://github.com/llvm/llvm-project/commit/6c4809825dcce24d63c59aed0d2992d383ebd86d
DIFF: https://github.com/llvm/llvm-project/commit/6c4809825dcce24d63c59aed0d2992d383ebd86d.diff

LOG: Revert "[lld] Add lto-pgo-warn-mismatch option"

This reverts commit 0cfb00a1c98f8ca3749b8d829b7301f397efa302.

Added: 
    

Modified: 
    lld/COFF/Config.h
    lld/COFF/Driver.cpp
    lld/COFF/LTO.cpp
    lld/COFF/Options.td
    lld/ELF/Config.h
    lld/ELF/Driver.cpp
    lld/ELF/LTO.cpp
    lld/ELF/Options.td
    llvm/include/llvm/LTO/Config.h
    llvm/lib/LTO/LTOBackend.cpp
    llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Removed: 
    lld/test/COFF/Inputs/thinlto_cs.proftext
    lld/test/COFF/thinlto-pgo-warn.ll
    lld/test/ELF/lto/Inputs/thinlto_cs.proftext
    lld/test/ELF/lto/thinlto-pgo-warn.ll


################################################################################
diff  --git a/lld/COFF/Config.h b/lld/COFF/Config.h
index 002d128838ce2..df883b779ee4a 100644
--- a/lld/COFF/Config.h
+++ b/lld/COFF/Config.h
@@ -223,9 +223,6 @@ struct Configuration {
   // Used for /lto-cs-profile-path
   llvm::StringRef ltoCSProfileFile;
 
-  // Used for /lto-pgo-warn-mismatch:
-  bool ltoPGOWarnMismatch = true;
-
   // Used for /call-graph-ordering-file:
   llvm::MapVector<std::pair<const SectionChunk *, const SectionChunk *>,
                   uint64_t>

diff  --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 5f6bc91c90487..9ba0db31507f2 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -1750,8 +1750,6 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
   config->ltoCSProfileGenerate = args.hasArg(OPT_lto_cs_profile_generate);
   config->ltoCSProfileFile = args.getLastArgValue(OPT_lto_cs_profile_file);
   // Handle miscellaneous boolean flags.
-  config->ltoPGOWarnMismatch = args.hasFlag(OPT_lto_pgo_warn_mismatch,
-                                            OPT_lto_pgo_warn_mismatch_no, true);
   config->allowBind = args.hasFlag(OPT_allowbind, OPT_allowbind_no, true);
   config->allowIsolation =
       args.hasFlag(OPT_allowisolation, OPT_allowisolation_no, true);

diff  --git a/lld/COFF/LTO.cpp b/lld/COFF/LTO.cpp
index 6e38f53f21362..d117abf86f79f 100644
--- a/lld/COFF/LTO.cpp
+++ b/lld/COFF/LTO.cpp
@@ -87,7 +87,6 @@ static lto::Config createConfig() {
   c.DebugPassManager = config->ltoDebugPassManager;
   c.CSIRProfile = std::string(config->ltoCSProfileFile);
   c.RunCSIRInstr = config->ltoCSProfileGenerate;
-  c.PGOWarnMismatch = config->ltoPGOWarnMismatch;
 
   if (config->saveTemps)
     checkError(c.addSaveTemps(std::string(config->outputFile) + ".",

diff  --git a/lld/COFF/Options.td b/lld/COFF/Options.td
index ce3392ce9dcb1..2ce145520ea89 100644
--- a/lld/COFF/Options.td
+++ b/lld/COFF/Options.td
@@ -244,10 +244,6 @@ def lto_cs_profile_generate: F<"lto-cs-profile-generate">,
     HelpText<"Perform context sensitive PGO instrumentation">;
 def lto_cs_profile_file : P<"lto-cs-profile-file",
     "Context sensitive profile file path">;
-defm lto_pgo_warn_mismatch: B<
-     "lto-pgo-warn-mismatch",
-     "turn on warnings about profile cfg mismatch (default)>",
-     "turn off warnings about profile cfg mismatch">;
 def dash_dash_version : Flag<["--"], "version">,
   HelpText<"Display the version number and exit">;
 def threads

diff  --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index a3d28d57d39a0..e1abb4dfab36a 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -178,7 +178,6 @@ struct Configuration {
   bool ignoreDataAddressEquality;
   bool ignoreFunctionAddressEquality;
   bool ltoCSProfileGenerate;
-  bool ltoPGOWarnMismatch;
   bool ltoDebugPassManager;
   bool ltoEmitAsm;
   bool ltoNewPassManager;

diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index dba6f64963904..551a3d3c3bb63 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1069,8 +1069,6 @@ static void readConfigs(opt::InputArgList &args) {
   config->ltoAAPipeline = args.getLastArgValue(OPT_lto_aa_pipeline);
   config->ltoCSProfileGenerate = args.hasArg(OPT_lto_cs_profile_generate);
   config->ltoCSProfileFile = args.getLastArgValue(OPT_lto_cs_profile_file);
-  config->ltoPGOWarnMismatch = args.hasFlag(OPT_lto_pgo_warn_mismatch,
-                                            OPT_no_lto_pgo_warn_mismatch, true);
   config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager);
   config->ltoEmitAsm = args.hasArg(OPT_lto_emit_asm);
   config->ltoNewPassManager =

diff  --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index 1f60e1e8a395c..e8710e3bdb4ff 100644
--- a/lld/ELF/LTO.cpp
+++ b/lld/ELF/LTO.cpp
@@ -163,7 +163,6 @@ static lto::Config createConfig() {
 
   c.CSIRProfile = std::string(config->ltoCSProfileFile);
   c.RunCSIRInstr = config->ltoCSProfileGenerate;
-  c.PGOWarnMismatch = config->ltoPGOWarnMismatch;
 
   if (config->emitLLVM) {
     c.PostInternalizeModuleHook = [](size_t task, const Module &m) {

diff  --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index b5c1be5c600cb..9667d859a6b42 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -563,9 +563,6 @@ def lto_cs_profile_generate: FF<"lto-cs-profile-generate">,
   HelpText<"Perform context sensitive PGO instrumentation">;
 def lto_cs_profile_file: JJ<"lto-cs-profile-file=">,
   HelpText<"Context sensitive profile file path">;
-defm lto_pgo_warn_mismatch: BB<"lto-pgo-warn-mismatch",
-  "turn on warnings about profile cfg mismatch (default)>",
-  "turn off warnings about profile cfg mismatch">;
 def lto_obj_path_eq: JJ<"lto-obj-path=">;
 def lto_sample_profile: JJ<"lto-sample-profile=">,
   HelpText<"Sample profile file path">;

diff  --git a/lld/test/COFF/Inputs/thinlto_cs.proftext b/lld/test/COFF/Inputs/thinlto_cs.proftext
deleted file mode 100644
index 9a060f7193e5d..0000000000000
--- a/lld/test/COFF/Inputs/thinlto_cs.proftext
+++ /dev/null
@@ -1,11 +0,0 @@
-# CSIR level Instrumentation Flag
-:csir
-f
-# Func Hash:
-1535914979662757887
-# Num Counters:
-2
-# Counter Values:
-1
-0
-

diff  --git a/lld/test/COFF/thinlto-pgo-warn.ll b/lld/test/COFF/thinlto-pgo-warn.ll
deleted file mode 100644
index c5865faad49cc..0000000000000
--- a/lld/test/COFF/thinlto-pgo-warn.ll
+++ /dev/null
@@ -1,57 +0,0 @@
-; REQUIRES: x86
-
-; Basic ThinLTO tests.
-; RUN: opt -module-summary %s -o %t1.obj
-; RUN: llvm-profdata merge %S/Inputs/thinlto_cs.proftext -o %t2.profdata
-
-; Ensure lld generates warnings for profile cfg mismatch.
-; RUN: lld-link /out:%t3.dll /dll /noentry /export:f /lto-cs-profile-file:%t2.profdata /lto-pgo-warn-mismatch /opt:lldlto=2 %t1.obj 2>&1 | FileCheck --check-prefix CHECK-WARNING %s
-
-; Ensure lld will not generate warnings for profile cfg mismatch.
-; RUN: lld-link /out:%t3.dll /dll /noentry /export:f /lto-cs-profile-file:%t2.profdata /lto-pgo-warn-mismatch:no /opt:lldlto=2 %t1.obj 2>&1 | FileCheck --allow-empty %s
-
-; CHECK-WARNING: warning: {{.*}} function control flow change detected (hash mismatch) f Hash = 1895182923573755903
-; CHECK-NOT: warning: {{.*}} function control flow change detected (hash mismatch) f Hash = 1895182923573755903
-
-target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-pc-windows-msvc"
-
-define i32 @f(i32 returned %a) #0 {
-entry:
-  ret i32 %a
-}
-
-attributes #0 = { "target-cpu"="x86-64" }
-
-!llvm.module.flags = !{!0, !1}
-
-!0 = !{i32 1, !"wchar_size", i32 4}
-!1 = !{i32 1, !"ProfileSummary", !2}
-!2 = !{!3, !4, !5, !6, !7, !8, !9, !10, !11, !12}
-!3 = !{!"ProfileFormat", !"InstrProf"}
-!4 = !{!"TotalCount", i64 2}
-!5 = !{!"MaxCount", i64 1}
-!6 = !{!"MaxInternalCount", i64 0}
-!7 = !{!"MaxFunctionCount", i64 1}
-!8 = !{!"NumCounts", i64 3}
-!9 = !{!"NumFunctions", i64 2}
-!10 = !{!"IsPartialProfile", i64 0}
-!11 = !{!"PartialProfileRatio", double 0.000000e+00}
-!12 = !{!"DetailedSummary", !13}
-!13 = !{!14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29}
-!14 = !{i32 10000, i64 0, i32 0}
-!15 = !{i32 100000, i64 0, i32 0}
-!16 = !{i32 200000, i64 0, i32 0}
-!17 = !{i32 300000, i64 0, i32 0}
-!18 = !{i32 400000, i64 0, i32 0}
-!19 = !{i32 500000, i64 1, i32 2}
-!20 = !{i32 600000, i64 1, i32 2}
-!21 = !{i32 700000, i64 1, i32 2}
-!22 = !{i32 800000, i64 1, i32 2}
-!23 = !{i32 900000, i64 1, i32 2}
-!24 = !{i32 950000, i64 1, i32 2}
-!25 = !{i32 990000, i64 1, i32 2}
-!26 = !{i32 999000, i64 1, i32 2}
-!27 = !{i32 999900, i64 1, i32 2}
-!28 = !{i32 999990, i64 1, i32 2}
-!29 = !{i32 999999, i64 1, i32 2}

diff  --git a/lld/test/ELF/lto/Inputs/thinlto_cs.proftext b/lld/test/ELF/lto/Inputs/thinlto_cs.proftext
deleted file mode 100644
index 9a060f7193e5d..0000000000000
--- a/lld/test/ELF/lto/Inputs/thinlto_cs.proftext
+++ /dev/null
@@ -1,11 +0,0 @@
-# CSIR level Instrumentation Flag
-:csir
-f
-# Func Hash:
-1535914979662757887
-# Num Counters:
-2
-# Counter Values:
-1
-0
-

diff  --git a/lld/test/ELF/lto/thinlto-pgo-warn.ll b/lld/test/ELF/lto/thinlto-pgo-warn.ll
deleted file mode 100644
index e258169b2f2e0..0000000000000
--- a/lld/test/ELF/lto/thinlto-pgo-warn.ll
+++ /dev/null
@@ -1,57 +0,0 @@
-; REQUIRES: x86
-
-;; Basic ThinLTO tests.
-; RUN: opt -module-summary %s -o %t1.bc
-; RUN: llvm-profdata merge %S/Inputs/thinlto_cs.proftext -o %t2.profdata
-
-;; Ensure lld generates warnings for profile cfg mismatch.
-; RUN: ld.lld --lto-cs-profile-file=%t2.profdata --lto-pgo-warn-mismatch --lto-O2 -shared %t1.bc -o /dev/null 2>&1 | FileCheck --check-prefix CHECK-WARNING %s
-
-;; Ensure lld will not generate warnings for profile cfg mismatch.
-; RUN: ld.lld --lto-cs-profile-file=%t2.profdata --no-lto-pgo-warn-mismatch --lto-O2 -shared %t1.bc -o /dev/null 2>&1 | FileCheck --allow-empty %s
-
-; CHECK-WARNING: warning: {{.*}} function control flow change detected (hash mismatch) f Hash = 1895182923573755903
-; CHECK-NOT: warning: {{.*}} function control flow change detected (hash mismatch) f Hash = 1895182923573755903
-
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define i32 @f(i32 returned %a) #0 {
-entry:
-  ret i32 %a
-}
-
-attributes #0 = { "target-cpu"="x86-64" }
-
-!llvm.module.flags = !{!0, !1}
-
-!0 = !{i32 1, !"wchar_size", i32 4}
-!1 = !{i32 1, !"ProfileSummary", !2}
-!2 = !{!3, !4, !5, !6, !7, !8, !9, !10, !11, !12}
-!3 = !{!"ProfileFormat", !"InstrProf"}
-!4 = !{!"TotalCount", i64 2}
-!5 = !{!"MaxCount", i64 1}
-!6 = !{!"MaxInternalCount", i64 0}
-!7 = !{!"MaxFunctionCount", i64 1}
-!8 = !{!"NumCounts", i64 3}
-!9 = !{!"NumFunctions", i64 2}
-!10 = !{!"IsPartialProfile", i64 0}
-!11 = !{!"PartialProfileRatio", double 0.000000e+00}
-!12 = !{!"DetailedSummary", !13}
-!13 = !{!14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29}
-!14 = !{i32 10000, i64 0, i32 0}
-!15 = !{i32 100000, i64 0, i32 0}
-!16 = !{i32 200000, i64 0, i32 0}
-!17 = !{i32 300000, i64 0, i32 0}
-!18 = !{i32 400000, i64 0, i32 0}
-!19 = !{i32 500000, i64 1, i32 2}
-!20 = !{i32 600000, i64 1, i32 2}
-!21 = !{i32 700000, i64 1, i32 2}
-!22 = !{i32 800000, i64 1, i32 2}
-!23 = !{i32 900000, i64 1, i32 2}
-!24 = !{i32 950000, i64 1, i32 2}
-!25 = !{i32 990000, i64 1, i32 2}
-!26 = !{i32 999000, i64 1, i32 2}
-!27 = !{i32 999900, i64 1, i32 2}
-!28 = !{i32 999990, i64 1, i32 2}
-!29 = !{i32 999999, i64 1, i32 2}

diff  --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h
index eb793d62907e2..5fd3c9f408f35 100644
--- a/llvm/include/llvm/LTO/Config.h
+++ b/llvm/include/llvm/LTO/Config.h
@@ -70,9 +70,6 @@ struct Config {
   /// Run PGO context sensitive IR instrumentation.
   bool RunCSIRInstr = false;
 
-  /// Turn on/off the warning about a hash mismatch in the PGO profile data.
-  bool PGOWarnMismatch = true;
-
   /// Asserts whether we can assume whole program visibility during the LTO
   /// link.
   bool HasWholeProgramVisibility = false;

diff  --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 6445cfe1f425b..5863ec695df0e 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -74,10 +74,6 @@ static cl::opt<bool> ThinLTOAssumeMerged(
     cl::desc("Assume the input has already undergone ThinLTO function "
              "importing and the other pre-optimization pipeline changes."));
 
-// Command line option to turn off/on warnings for pgo profile mismatch.
-// Defined in Transforms/PGOInstrumentation.cpp:  -no-pgo-warn-mismatch
-extern cl::opt<bool> NoPGOWarnMismatch;
-
 [[noreturn]] static void reportOpenError(StringRef Path, Twine Msg) {
   errs() << "failed to open " << Path << ": " << Msg << '\n';
   errs().flush();
@@ -225,7 +221,6 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
     PGOOpt = PGOOptions(Conf.CSIRProfile, "", Conf.ProfileRemapping,
                         PGOOptions::IRUse, PGOOptions::CSIRUse,
                         Conf.AddFSDiscriminator);
-    NoPGOWarnMismatch = !Conf.PGOWarnMismatch;
   } else if (Conf.AddFSDiscriminator) {
     PGOOpt = PGOOptions("", "", "", PGOOptions::NoAction,
                         PGOOptions::NoCSAction, true);

diff  --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index c584f26bf43d8..3d9261eb99ba4 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -200,7 +200,7 @@ static cl::opt<bool>
 
 // Command line option to enable/disable the warning about a hash mismatch in
 // the profile data.
-cl::opt<bool>
+static 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."));


        


More information about the llvm-commits mailing list