Only enable hotness information when PGO is available
This commit is contained in:
parent
93bdc01adf
commit
9d417d7c86
@ -320,6 +320,7 @@ impl<'a> DiagnosticHandlers<'a> {
|
||||
})
|
||||
.and_then(|dir| dir.to_str().and_then(|p| CString::new(p).ok()));
|
||||
|
||||
let pgo_available = cgcx.opts.cg.profile_use.is_some();
|
||||
let data = Box::into_raw(Box::new((cgcx, handler)));
|
||||
unsafe {
|
||||
let old_handler = llvm::LLVMRustContextGetDiagnosticHandler(llcx);
|
||||
@ -333,6 +334,7 @@ impl<'a> DiagnosticHandlers<'a> {
|
||||
// The `as_ref()` is important here, otherwise the `CString` will be dropped
|
||||
// too soon!
|
||||
remark_file.as_ref().map(|dir| dir.as_ptr()).unwrap_or(std::ptr::null()),
|
||||
pgo_available,
|
||||
);
|
||||
DiagnosticHandlers { data, llcx, old_handler }
|
||||
}
|
||||
|
@ -2332,6 +2332,7 @@ extern "C" {
|
||||
remark_passes: *const *const c_char,
|
||||
remark_passes_len: usize,
|
||||
remark_file: *const c_char,
|
||||
pgo_available: bool,
|
||||
);
|
||||
|
||||
#[allow(improper_ctypes)]
|
||||
|
@ -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>(
|
||||
|
@ -1,4 +1,8 @@
|
||||
# needs-profiler-support
|
||||
# ignore-windows-gnu
|
||||
|
||||
# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
|
||||
# properly. Since we only have GCC on the CI ignore the test for now.
|
||||
|
||||
include ../tools.mk
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user