Auto merge of #83666 - Amanieu:instrprof-order, r=tmandry
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. Fixes #83429 cc `@richkadel` r? `@tmandry`
This commit is contained in:
commit
6ff482bde5
9 changed files with 29 additions and 60 deletions
|
@ -2890,17 +2890,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
|
|||
.emit();
|
||||
InlineAttr::None
|
||||
} else if list_contains_name(&items[..], sym::always) {
|
||||
if tcx.sess.instrument_coverage() {
|
||||
// Fixes Issue #82875. Forced inlining allows LLVM to discard functions
|
||||
// marked with `#[inline(always)]`, which can break coverage reporting if
|
||||
// that function was referenced from a coverage map.
|
||||
//
|
||||
// FIXME(#83429): Is there a better place, e.g., in codegen, to check and
|
||||
// convert `Always` to `Hint`?
|
||||
InlineAttr::Hint
|
||||
} else {
|
||||
InlineAttr::Always
|
||||
}
|
||||
InlineAttr::Always
|
||||
} else if list_contains_name(&items[..], sym::never) {
|
||||
InlineAttr::Never
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue