Skip to content

Commit d6be483

Browse files
committed
Auto merge of #132779 - klensy:pgo-cold, r=<try>
try ColdFuncOpt variants for PGO r? `@ghost`
2 parents 59cec72 + b985925 commit d6be483

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -712,15 +712,15 @@ extern "C" LLVMRustResult LLVMRustOptimize(
712712
PGOOpt = PGOOptions(PGOGenPath, "", "", "", FS, PGOOptions::IRInstr,
713713
PGOOptions::NoCSAction,
714714
#if LLVM_VERSION_GE(19, 0)
715-
PGOOptions::ColdFuncOpt::Default,
715+
PGOOptions::ColdFuncOpt::MinSize,
716716
#endif
717717
DebugInfoForProfiling);
718718
} else if (PGOUsePath) {
719719
assert(!PGOSampleUsePath);
720720
PGOOpt = PGOOptions(PGOUsePath, "", "", "", FS, PGOOptions::IRUse,
721721
PGOOptions::NoCSAction,
722722
#if LLVM_VERSION_GE(19, 0)
723-
PGOOptions::ColdFuncOpt::Default,
723+
PGOOptions::ColdFuncOpt::MinSize,
724724
#endif
725725
DebugInfoForProfiling);
726726
} else if (PGOSampleUsePath) {

src/bootstrap/src/core/build_steps/compile.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1112,13 +1112,15 @@ pub fn rustc_cargo(
11121112
// Apparently necessary to avoid overflowing the counters during
11131113
// a Cargo build profile
11141114
cargo.rustflag("-Cllvm-args=-vp-counters-per-site=4");
1115+
cargo.rustflag("-Cllvm-args=-enable-pgo-force-function-attrs");
11151116
true
11161117
} else {
11171118
false
11181119
}
11191120
} else if let Some(path) = &builder.config.rust_profile_use {
11201121
if compiler.stage == 1 {
11211122
cargo.rustflag(&format!("-Cprofile-use={path}"));
1123+
cargo.rustflag("-Cllvm-args=-enable-pgo-force-function-attrs");
11221124
if builder.is_verbose() {
11231125
cargo.rustflag("-Cllvm-args=-pgo-warn-missing-function");
11241126
}

0 commit comments

Comments
 (0)