coverage: Re-enable UnreachablePropagation for coverage builds

This commit is contained in:
Zalathar 2024-03-22 13:34:26 +11:00
parent 54116c8cae
commit 1cca2529d1
2 changed files with 4 additions and 8 deletions

View File

@ -14,11 +14,7 @@ pub struct UnreachablePropagation;
impl MirPass<'_> for UnreachablePropagation {
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
// Enable only under -Zmir-opt-level=2 as this can make programs less debuggable.
// FIXME(#116171) Coverage gets confused by MIR passes that can remove all
// coverage statements from an instrumented function. This pass can be
// re-enabled when coverage codegen is robust against that happening.
sess.mir_opt_level() >= 2 && !sess.instrument_coverage()
sess.mir_opt_level() >= 2
}
fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {

View File

@ -14,11 +14,11 @@ Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 17, 1) to (start + 1, 37)
Function name: unreachable::unreachable_intrinsic
Raw bytes (9): 0x[01, 01, 00, 01, 01, 16, 01, 01, 2c]
Function name: unreachable::unreachable_intrinsic (unused)
Raw bytes (9): 0x[01, 01, 00, 01, 00, 16, 01, 01, 2c]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 22, 1) to (start + 1, 44)
- Code(Zero) at (prev + 22, 1) to (start + 1, 44)