Apply review feedback

This commit is contained in:
Amanieu d'Antras 2021-03-30 07:03:41 +01:00
parent 26d260bfa4
commit cad9b6b695
3 changed files with 94 additions and 78 deletions

View file

@ -549,7 +549,11 @@ pub(crate) unsafe fn optimize(
continue;
}
if pass_name == "insert-gcov-profiling" || pass_name == "instrprof" {
// Instrumentation should be inserted before optimization.
// Instrumentation must be inserted before optimization,
// otherwise LLVM may optimize some functions away which
// breaks llvm-cov.
//
// This mirrors what Clang does in lib/CodeGen/BackendUtil.cpp.
llvm::LLVMRustAddPass(mpm, find_pass(pass_name).unwrap());
continue;
}