aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorYolanda Chen <yolanda.chen@intel.com>2021-08-11 13:22:36 +0800
committerWang, Pengfei <pengfei.wang@intel.com>2021-08-11 14:43:26 +0800
commit0cfb00a1c98f8ca3749b8d829b7301f397efa302 (patch)
treed5d319ce4205c4039ce22d85c0d4659e79ede2bd /llvm/lib/LTO/LTOBackend.cpp
parent98e30a9b4704a49e8b12591ae3b307f9d80e4803 (diff)
downloadllvm-0cfb00a1c98f8ca3749b8d829b7301f397efa302.zip
llvm-0cfb00a1c98f8ca3749b8d829b7301f397efa302.tar.gz
llvm-0cfb00a1c98f8ca3749b8d829b7301f397efa302.tar.bz2
[lld] Add lto-pgo-warn-mismatch option
When enable CSPGO for ThinLTO, there are profile cfg mismatch warnings that will cause lld-link errors (with /WX). To disable it we have to use an internal "/mllvm:-no-pgo-warn-mismatch" option. In contrast clang uses option ”-Wno-backend-plugin“ to avoid such warnings and gcc has an explicit "-Wno-coverage-mismatch" option. Add this "lto-pgo-warn-mismatch" option to lld to help turn on/off the profile mismatch warnings explicitly when build with ThinLTO and CSPGO. Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D104431
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 5863ec6..6445cfe 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -74,6 +74,10 @@ 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();
@@ -221,6 +225,7 @@ 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);