diff options
author | Adam Nemet <anemet@apple.com> | 2016-12-02 17:53:56 +0000 |
---|---|---|
committer | Adam Nemet <anemet@apple.com> | 2016-12-02 17:53:56 +0000 |
commit | 4c207a6a1fa1d5d94e00b99770733d7c2cee21c2 (patch) | |
tree | cde49364f131b11cd8b40a46ceabdd140f6df5fe /llvm/lib | |
parent | 4df50e1fb0ad397e029beda0368f24dcde138df3 (diff) | |
download | bcm5719-llvm-4c207a6a1fa1d5d94e00b99770733d7c2cee21c2.tar.gz bcm5719-llvm-4c207a6a1fa1d5d94e00b99770733d7c2cee21c2.zip |
[LTOs] Allow generation of hotness information
The flag is passed by the clang driver.
Differential Revision: https://reviews.llvm.org/D27331
llvm-svn: 288519
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/LTO/LTOCodeGenerator.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 5aa91c4c689..6af31e61f94 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -96,6 +96,11 @@ cl::opt<std::string> LTORemarksFilename("lto-pass-remarks-output", cl::desc("Output filename for pass remarks"), cl::value_desc("filename")); + +cl::opt<bool> LTOPassRemarksWithHotness( + "lto-pass-remarks-with-hotness", + cl::desc("With PGO, include profile count in optimization remarks"), + cl::Hidden); } LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context) @@ -513,6 +518,10 @@ bool LTOCodeGenerator::setupOptimizationRemarks() { Context.setDiagnosticsOutputFile( llvm::make_unique<yaml::Output>(DiagnosticOutputFile->os())); } + + if (LTOPassRemarksWithHotness) + Context.setDiagnosticHotnessRequested(true); + return true; } diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 2a75b8bbef7..ae5d8a0255f 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -65,6 +65,7 @@ namespace llvm { // Flags -discard-value-names, defined in LTOCodeGenerator.cpp extern cl::opt<bool> LTODiscardValueNames; extern cl::opt<std::string> LTORemarksFilename; +extern cl::opt<bool> LTOPassRemarksWithHotness; } namespace { @@ -74,6 +75,9 @@ static cl::opt<int> Expected<std::unique_ptr<tool_output_file>> setupOptimizationRemarks(LLVMContext &Ctx, int Count) { + if (LTOPassRemarksWithHotness) + Ctx.setDiagnosticHotnessRequested(true); + if (LTORemarksFilename.empty()) return nullptr; |