diff options
author | Wei Wang <apollo.mobility@gmail.com> | 2020-11-17 10:37:59 -0800 |
---|---|---|
committer | Wei Wang <apollo.mobility@gmail.com> | 2020-11-30 21:55:49 -0800 |
commit | 3acda91742b7e995af87f1afaca5e0fa78669819 (patch) | |
tree | 69ce1c1c6d2d406465c68fb335e43ac2286aed0c /llvm/tools/gold | |
parent | bcc802fa3624ac8cc98b8a11f5315b07fc7bffc4 (diff) | |
download | llvm-3acda91742b7e995af87f1afaca5e0fa78669819.zip llvm-3acda91742b7e995af87f1afaca5e0fa78669819.tar.gz llvm-3acda91742b7e995af87f1afaca5e0fa78669819.tar.bz2 |
[Remarks][1/2] Expand remarks hotness threshold option support in more tools
This is the #1 of 2 changes that make remarks hotness threshold option
available in more tools. The changes also allow the threshold to sync with
hotness threshold from profile summary with special value 'auto'.
This change modifies the interface of lto::setupLLVMOptimizationRemarks() to
accept remarks hotness threshold. Update all the tools that use it with remarks
hotness threshold options:
* lld: '--opt-remarks-hotness-threshold='
* llvm-lto2: '--pass-remarks-hotness-threshold='
* llvm-lto: '--lto-pass-remarks-hotness-threshold='
* gold plugin: '-plugin-opt=opt-remarks-hotness-threshold='
Differential Revision: https://reviews.llvm.org/D85809
Diffstat (limited to 'llvm/tools/gold')
-rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index ebd08c4..0ac8922 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -21,6 +21,7 @@ #include "llvm/LTO/Caching.h" #include "llvm/LTO/LTO.h" #include "llvm/Object/Error.h" +#include "llvm/Remarks/HotnessThresholdParser.h" #include "llvm/Support/CachePruning.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" @@ -213,6 +214,7 @@ namespace options { static std::string RemarksFilename; static std::string RemarksPasses; static bool RemarksWithHotness = false; + static Optional<uint64_t> RemarksHotnessThreshold = 0; static std::string RemarksFormat; // Context sensitive PGO options. @@ -297,6 +299,12 @@ namespace options { RemarksPasses = std::string(opt); } else if (opt == "opt-remarks-with-hotness") { RemarksWithHotness = true; + } else if (opt.consume_front("opt-remarks-hotness-threshold=")) { + auto ResultOrErr = remarks::parseHotnessThresholdOption(opt); + if (!ResultOrErr) + message(LDPL_FATAL, "Invalid remarks hotness threshold: %s", opt); + else + RemarksHotnessThreshold = *ResultOrErr; } else if (opt.consume_front("opt-remarks-format=")) { RemarksFormat = std::string(opt); } else if (opt.consume_front("stats-file=")) { @@ -931,6 +939,7 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite, Conf.RemarksFilename = options::RemarksFilename; Conf.RemarksPasses = options::RemarksPasses; Conf.RemarksWithHotness = options::RemarksWithHotness; + Conf.RemarksHotnessThreshold = options::RemarksHotnessThreshold; Conf.RemarksFormat = options::RemarksFormat; // Use new pass manager if set in driver |