diff --git a/compiler/rustc_mir_transform/src/pass_manager.rs b/compiler/rustc_mir_transform/src/pass_manager.rs index ddf16d3fff4c4..314411d605c60 100644 --- a/compiler/rustc_mir_transform/src/pass_manager.rs +++ b/compiler/rustc_mir_transform/src/pass_manager.rs @@ -333,8 +333,10 @@ fn run_passes_inner<'tcx>( continue; }; - if is_optimization_stage(body, phase_change) + if body.phase == MirPhase::Runtime(RuntimePhase::PostCleanup) + && phase_change == Some(MirPhase::Runtime(RuntimePhase::Optimized)) && let Some(limit) = &tcx.sess.opts.unstable_opts.mir_opt_bisect_limit + && matches!(pass.policy(&ctx), PassPolicy::Optional { .. }) && limited_by_opt_bisect( tcx, tcx.def_path_debug_str(body.source.def_id()), @@ -417,11 +419,6 @@ pub(super) fn dump_mir_for_phase_change<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tc } } -fn is_optimization_stage(body: &Body<'_>, phase_change: Option) -> bool { - body.phase == MirPhase::Runtime(RuntimePhase::PostCleanup) - && phase_change == Some(MirPhase::Runtime(RuntimePhase::Optimized)) -} - fn limited_by_opt_bisect<'tcx, P>( tcx: TyCtxt<'tcx>, def_path: String,