diff options
Diffstat (limited to 'llvm/lib/LTO')
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/LTO/LTOCodeGenerator.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 4 |
4 files changed, 19 insertions, 7 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index e9ac314e7c8..58b1cd01b2a 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -1202,10 +1202,10 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache) { return BackendProc->wait(); } -Expected<std::unique_ptr<ToolOutputFile>> -lto::setupOptimizationRemarks(LLVMContext &Context, - StringRef LTORemarksFilename, - bool LTOPassRemarksWithHotness, int Count) { +Expected<std::unique_ptr<ToolOutputFile>> lto::setupOptimizationRemarks( + LLVMContext &Context, StringRef LTORemarksFilename, + bool LTOPassRemarksWithHotness, unsigned LTOPassRemarksHotnessThreshold, + int Count) { if (LTORemarksFilename.empty()) return nullptr; @@ -1222,6 +1222,8 @@ lto::setupOptimizationRemarks(LLVMContext &Context, llvm::make_unique<yaml::Output>(DiagnosticFile->os())); if (LTOPassRemarksWithHotness) Context.setDiagnosticsHotnessRequested(true); + if (LTOPassRemarksHotnessThreshold) + Context.setDiagnosticsHotnessThreshold(LTOPassRemarksHotnessThreshold); DiagnosticFile->keep(); return std::move(DiagnosticFile); } diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 074a3986015..4607444e7f1 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -376,7 +376,8 @@ Error lto::backend(Config &C, AddStreamFn AddStream, // Setup optimization remarks. auto DiagFileOrErr = lto::setupOptimizationRemarks( - Mod->getContext(), C.RemarksFilename, C.RemarksWithHotness); + Mod->getContext(), C.RemarksFilename, C.RemarksWithHotness, + C.RemarksHotnessThreshold); if (!DiagFileOrErr) return DiagFileOrErr.takeError(); auto DiagnosticOutputFile = std::move(*DiagFileOrErr); diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index ffe9af74cdc..939d12a20be 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -89,6 +89,12 @@ cl::opt<bool> LTOPassRemarksWithHotness( "lto-pass-remarks-with-hotness", cl::desc("With PGO, include profile count in optimization remarks"), cl::Hidden); + +cl::opt<unsigned> LTOPassRemarksHotnessThreshold( + "lto-pass-remarks-hotness-threshold", + cl::desc("Minimum profile count required for an optimization remark to be " + "output"), + cl::Hidden); } LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context) @@ -505,7 +511,8 @@ bool LTOCodeGenerator::optimize(bool DisableVerify, bool DisableInline, return false; auto DiagFileOrErr = lto::setupOptimizationRemarks( - Context, LTORemarksFilename, LTOPassRemarksWithHotness); + Context, LTORemarksFilename, LTOPassRemarksWithHotness, + LTOPassRemarksHotnessThreshold); if (!DiagFileOrErr) { errs() << "Error: " << toString(DiagFileOrErr.takeError()) << "\n"; report_fatal_error("Can't get an output file for the remarks"); diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 92cc2450773..b3e30b6a4cd 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -63,6 +63,7 @@ namespace llvm { extern cl::opt<bool> LTODiscardValueNames; extern cl::opt<std::string> LTORemarksFilename; extern cl::opt<bool> LTOPassRemarksWithHotness; +extern cl::opt<unsigned> LTOPassRemarksHotnessThreshold; } namespace { @@ -998,7 +999,8 @@ void ThinLTOCodeGenerator::run() { Context.setDiscardValueNames(LTODiscardValueNames); Context.enableDebugTypeODRUniquing(); auto DiagFileOrErr = lto::setupOptimizationRemarks( - Context, LTORemarksFilename, LTOPassRemarksWithHotness, count); + Context, LTORemarksFilename, LTOPassRemarksWithHotness, + LTOPassRemarksHotnessThreshold, count); if (!DiagFileOrErr) { errs() << "Error: " << toString(DiagFileOrErr.takeError()) << "\n"; report_fatal_error("ThinLTO: Can't get an output file for the " |