1
Fork 0

Auto merge of #114439 - Kobzol:remark-pgo-hotness, r=tmiasko

Add hotness data to LLVM remarks

Slight improvement of https://github.com/rust-lang/rust/pull/113040. This makes sure that if PGO is used, remarks generated using `-Zremark-dir` will include the `Hotness` attribute.

r? `@tmiasko`
This commit is contained in:
bors 2023-08-08 15:41:44 +00:00
commit f525bb4e2a
5 changed files with 36 additions and 1 deletions

View file

@ -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,6 +1968,11 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
std::unique_ptr<LLVMRemarkStreamer> LlvmRemarkStreamer;
if (RemarkFilePath != nullptr) {
if (PGOAvailable) {
// Enable PGO hotness data for remarks, if available
unwrap(C)->setDiagnosticsHotnessRequested(true);
}
std::error_code EC;
RemarkFile = std::make_unique<ToolOutputFile>(
RemarkFilePath,