File tree 4 files changed +13
-3
lines changed
4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,7 @@ impl<'a> DiagnosticHandlers<'a> {
320
320
} )
321
321
. and_then ( |dir| dir. to_str ( ) . and_then ( |p| CString :: new ( p) . ok ( ) ) ) ;
322
322
323
+ let pgo_available = cgcx. opts . cg . profile_use . is_some ( ) ;
323
324
let data = Box :: into_raw ( Box :: new ( ( cgcx, handler) ) ) ;
324
325
unsafe {
325
326
let old_handler = llvm:: LLVMRustContextGetDiagnosticHandler ( llcx) ;
@@ -333,6 +334,7 @@ impl<'a> DiagnosticHandlers<'a> {
333
334
// The `as_ref()` is important here, otherwise the `CString` will be dropped
334
335
// too soon!
335
336
remark_file. as_ref ( ) . map ( |dir| dir. as_ptr ( ) ) . unwrap_or ( std:: ptr:: null ( ) ) ,
337
+ pgo_available,
336
338
) ;
337
339
DiagnosticHandlers { data, llcx, old_handler }
338
340
}
Original file line number Diff line number Diff line change @@ -2332,6 +2332,7 @@ extern "C" {
2332
2332
remark_passes : * const * const c_char ,
2333
2333
remark_passes_len : usize ,
2334
2334
remark_file : * const c_char ,
2335
+ pgo_available : bool ,
2335
2336
) ;
2336
2337
2337
2338
#[ allow( improper_ctypes) ]
Original file line number Diff line number Diff line change @@ -1869,7 +1869,8 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
1869
1869
LLVMContextRef C, LLVMDiagnosticHandlerTy DiagnosticHandlerCallback,
1870
1870
void *DiagnosticHandlerContext, bool RemarkAllPasses,
1871
1871
const char * const * RemarkPasses, size_t RemarkPassesLen,
1872
- const char * RemarkFilePath
1872
+ const char * RemarkFilePath,
1873
+ bool PGOAvailable
1873
1874
) {
1874
1875
1875
1876
class RustDiagnosticHandler final : public DiagnosticHandler {
@@ -1967,8 +1968,10 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
1967
1968
std::unique_ptr<LLVMRemarkStreamer> LlvmRemarkStreamer;
1968
1969
1969
1970
if (RemarkFilePath != nullptr ) {
1970
- // Enable PGO hotness data for remarks, if available
1971
- unwrap (C)->setDiagnosticsHotnessRequested (true );
1971
+ if (PGOAvailable) {
1972
+ // Enable PGO hotness data for remarks, if available
1973
+ unwrap (C)->setDiagnosticsHotnessRequested (true );
1974
+ }
1972
1975
1973
1976
std::error_code EC;
1974
1977
RemarkFile = std::make_unique<ToolOutputFile>(
Original file line number Diff line number Diff line change 1
1
# needs-profiler-support
2
+ # ignore-windows-gnu
3
+
4
+ # FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
5
+ # properly. Since we only have GCC on the CI ignore the test for now.
2
6
3
7
include ../tools.mk
4
8
You can’t perform that action at this time.
0 commit comments