Enable AutoFDO.
This largely involves implementing the options debug-info-for-profiling and profile-sample-use and forwarding them on to LLVM. AutoFDO can be used on x86-64 Linux like this: rustc -O -Cdebug-info-for-profiling main.rs -o main perf record -b ./main create_llvm_prof --binary=main --out=code.prof rustc -O -Cprofile-sample-use=code.prof main.rs -o main2 Now `main2` will have feedback directed optimization applied to it. The create_llvm_prof tool can be obtained from this github repository: https://github.com/google/autofdo Fixes #64892.
This commit is contained in:
@@ -2176,6 +2176,7 @@ extern "C" {
|
||||
PrepareForThinLTO: bool,
|
||||
PGOGenPath: *const c_char,
|
||||
PGOUsePath: *const c_char,
|
||||
PGOSampleUsePath: *const c_char,
|
||||
);
|
||||
pub fn LLVMRustAddLibraryInfo(
|
||||
PM: &PassManager<'a>,
|
||||
@@ -2210,6 +2211,8 @@ extern "C" {
|
||||
PGOUsePath: *const c_char,
|
||||
InstrumentCoverage: bool,
|
||||
InstrumentGCOV: bool,
|
||||
PGOSampleUsePath: *const c_char,
|
||||
DebugInfoForProfiling: bool,
|
||||
llvm_selfprofiler: *mut c_void,
|
||||
begin_callback: SelfProfileBeforePassCallback,
|
||||
end_callback: SelfProfileAfterPassCallback,
|
||||
|
||||
Reference in New Issue
Block a user