Explicitly register instrprof pass
Don't use "passes" for this purpose, explicitly insert it into the correct place in the pipeline instead.
This commit is contained in:
parent
0318883cd6
commit
5ecbe7fcf8
4 changed files with 20 additions and 8 deletions
|
@ -472,6 +472,7 @@ pub(crate) unsafe fn optimize_with_new_llvm_pass_manager(
|
|||
sanitizer_options.as_ref(),
|
||||
pgo_gen_path.as_ref().map_or(std::ptr::null(), |s| s.as_ptr()),
|
||||
pgo_use_path.as_ref().map_or(std::ptr::null(), |s| s.as_ptr()),
|
||||
config.instrument_coverage,
|
||||
llvm_selfprofiler,
|
||||
selfprofile_before_pass_callback,
|
||||
selfprofile_after_pass_callback,
|
||||
|
@ -545,7 +546,7 @@ pub(crate) unsafe fn optimize(
|
|||
llvm::LLVMRustAddPass(fpm, find_pass("lint").unwrap());
|
||||
continue;
|
||||
}
|
||||
if pass_name == "insert-gcov-profiling" || pass_name == "instrprof" {
|
||||
if pass_name == "insert-gcov-profiling" {
|
||||
// Instrumentation must be inserted before optimization,
|
||||
// otherwise LLVM may optimize some functions away which
|
||||
// breaks llvm-cov.
|
||||
|
@ -566,6 +567,10 @@ pub(crate) unsafe fn optimize(
|
|||
}
|
||||
}
|
||||
|
||||
if config.instrument_coverage {
|
||||
llvm::LLVMRustAddPass(mpm, find_pass("instrprof").unwrap());
|
||||
}
|
||||
|
||||
add_sanitizer_passes(config, &mut extra_passes);
|
||||
|
||||
// Some options cause LLVM bitcode to be emitted, which uses ThinLTOBuffers, so we need
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue