mod instcombine;
mod lower_intrinsics;
mod lower_slice_len;
-mod marker;
mod match_branches;
mod multiple_return_terminators;
mod normalize_array_len;
&simplify::SimplifyCfg::new("initial"),
&rustc_peek::SanityCheck, // Just a lint
],
+ None,
);
tcx.alloc_steal_mir(body)
}
&simplify::SimplifyCfg::new("promote-consts"),
&coverage::InstrumentCoverage,
],
+ Some(MirPhase::Analysis(AnalysisPhase::Initial)),
);
let promoted = promote_pass.promoted_fragments.into_inner();
pm::run_passes(
tcx,
&mut body,
- &[
- &const_prop::ConstProp,
- &marker::PhaseChange(MirPhase::Runtime(RuntimePhase::Optimized)),
- ],
+ &[&const_prop::ConstProp],
+ Some(MirPhase::Runtime(RuntimePhase::Optimized)),
);
}
}
&remove_uninit_drops::RemoveUninitDrops,
&simplify::SimplifyCfg::new("remove-false-edges"),
],
+ None,
);
check_consts::post_drop_elaboration::check_live_drops(tcx, &body); // FIXME: make this a MIR lint
}
&cleanup_post_borrowck::CleanupNonCodegenStatements,
&simplify::SimplifyCfg::new("early-opt"),
&deref_separator::Derefer,
- &marker::PhaseChange(MirPhase::Analysis(AnalysisPhase::PostCleanup)),
];
- pm::run_passes(tcx, body, passes);
+ pm::run_passes(tcx, body, passes, Some(MirPhase::Analysis(AnalysisPhase::PostCleanup)));
}
/// Returns the sequence of passes that lowers analysis to runtime MIR.
// CTFE support for aggregates.
&deaggregator::Deaggregator,
&Lint(const_prop_lint::ConstProp),
- &marker::PhaseChange(MirPhase::Runtime(RuntimePhase::Initial)),
];
- pm::run_passes_no_validate(tcx, body, passes);
+ pm::run_passes_no_validate(tcx, body, passes, Some(MirPhase::Runtime(RuntimePhase::Initial)));
}
/// Returns the sequence of passes that do the initial cleanup of runtime MIR.
&elaborate_box_derefs::ElaborateBoxDerefs,
&lower_intrinsics::LowerIntrinsics,
&simplify::SimplifyCfg::new("elaborate-drops"),
- &marker::PhaseChange(MirPhase::Runtime(RuntimePhase::PostCleanup)),
];
- pm::run_passes(tcx, body, passes);
+ pm::run_passes(tcx, body, passes, Some(MirPhase::Runtime(RuntimePhase::PostCleanup)));
}
fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
&deduplicate_blocks::DeduplicateBlocks,
// Some cleanup necessary at least for LLVM and potentially other codegen backends.
&add_call_guards::CriticalCallEdges,
- &marker::PhaseChange(MirPhase::Runtime(RuntimePhase::Optimized)),
// Dump the end result for testing and debugging purposes.
&dump_mir::Marker("PreCodegen"),
],
+ Some(MirPhase::Runtime(RuntimePhase::Optimized)),
);
}