diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 5d2df6ddfc912..077c5184c0c97 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -712,7 +712,7 @@ extern "C" LLVMRustResult LLVMRustOptimize( PGOOpt = PGOOptions(PGOGenPath, "", "", "", FS, PGOOptions::IRInstr, PGOOptions::NoCSAction, #if LLVM_VERSION_GE(19, 0) - PGOOptions::ColdFuncOpt::Default, + PGOOptions::ColdFuncOpt::MinSize, #endif DebugInfoForProfiling); } else if (PGOUsePath) { @@ -720,7 +720,7 @@ extern "C" LLVMRustResult LLVMRustOptimize( PGOOpt = PGOOptions(PGOUsePath, "", "", "", FS, PGOOptions::IRUse, PGOOptions::NoCSAction, #if LLVM_VERSION_GE(19, 0) - PGOOptions::ColdFuncOpt::Default, + PGOOptions::ColdFuncOpt::MinSize, #endif DebugInfoForProfiling); } else if (PGOSampleUsePath) { diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 9ddcde7eb2cfc..6df5a186c6c16 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1113,6 +1113,7 @@ pub fn rustc_cargo( // Apparently necessary to avoid overflowing the counters during // a Cargo build profile cargo.rustflag("-Cllvm-args=-vp-counters-per-site=4"); + cargo.rustflag("-Cllvm-args=-enable-pgo-force-function-attrs"); true } else { false @@ -1120,6 +1121,7 @@ pub fn rustc_cargo( } else if let Some(path) = &builder.config.rust_profile_use { if compiler.stage == 1 { cargo.rustflag(&format!("-Cprofile-use={path}")); + cargo.rustflag("-Cllvm-args=-enable-pgo-force-function-attrs"); if builder.is_verbose() { cargo.rustflag("-Cllvm-args=-pgo-warn-missing-function"); }