Run LLVM coverage instrumentation passes before optimization passes
This matches the behavior of Clang and allows us to remove several hacks which were needed to ensure functions weren't optimized away before reaching the instrumentation pass.
This commit is contained in:
parent
3debe9acb8
commit
26d260bfa4
9 changed files with 91 additions and 138 deletions
|
@ -548,6 +548,11 @@ pub(crate) unsafe fn optimize(
|
|||
llvm::LLVMRustAddPass(fpm, find_pass("lint").unwrap());
|
||||
continue;
|
||||
}
|
||||
if pass_name == "insert-gcov-profiling" || pass_name == "instrprof" {
|
||||
// Instrumentation should be inserted before optimization.
|
||||
llvm::LLVMRustAddPass(mpm, find_pass(pass_name).unwrap());
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Some(pass) = find_pass(pass_name) {
|
||||
extra_passes.push(pass);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue