about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2023-08-07 17:56:57 +0200
committerJakub Beránek <berykubik@gmail.com>2023-08-08 15:36:55 +0200
commit9d417d7c86259498855fc50ba0e853edbb13320d (patch)
tree1f360ee3eab0da8a5abf9396f640749e551a0617 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent93bdc01adf7091e473e36620d3f748ce0481f880 (diff)
downloadrust-9d417d7c86259498855fc50ba0e853edbb13320d.tar.gz
rust-9d417d7c86259498855fc50ba0e853edbb13320d.zip
Only enable hotness information when PGO is available
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 8c04a430573..a701827e057 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1869,7 +1869,8 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
     LLVMContextRef C, LLVMDiagnosticHandlerTy DiagnosticHandlerCallback,
     void *DiagnosticHandlerContext, bool RemarkAllPasses,
     const char * const * RemarkPasses, size_t RemarkPassesLen,
-    const char * RemarkFilePath
+    const char * RemarkFilePath,
+    bool PGOAvailable
 ) {
 
   class RustDiagnosticHandler final : public DiagnosticHandler {
@@ -1967,8 +1968,10 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
   std::unique_ptr<LLVMRemarkStreamer> LlvmRemarkStreamer;
 
   if (RemarkFilePath != nullptr) {
-    // Enable PGO hotness data for remarks, if available
-    unwrap(C)->setDiagnosticsHotnessRequested(true);
+    if (PGOAvailable) {
+      // Enable PGO hotness data for remarks, if available
+      unwrap(C)->setDiagnosticsHotnessRequested(true);
+    }
 
     std::error_code EC;
     RemarkFile = std::make_unique<ToolOutputFile>(