Skip to content

Commit

Permalink
Allow MIR pass UnreachableProp when coverage is enabled
Browse files Browse the repository at this point in the history
Now that coverage has a dedicated MIR pass to detect and repair instrumented
functions that have lost all their counters, it should be OK to permit this
pass in coverage builds.
  • Loading branch information
Zalathar committed Oct 19, 2023
1 parent 333f1ae commit 0658e90
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions compiler/rustc_mir_transform/src/unreachable_prop.rs
Expand Up @@ -13,11 +13,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>) {
Expand Down

0 comments on commit 0658e90

Please sign in to comment.