Only check in a single place if a pass is enabled.

This commit is contained in:
Camille GILLOT 2023-10-18 16:34:04 +00:00
parent e1de04ad4e
commit c1c5a1d69a
3 changed files with 41 additions and 13 deletions

View file

@ -383,7 +383,7 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> &
let is_fn_like = tcx.def_kind(def).is_fn_like();
if is_fn_like {
// Do not compute the mir call graph without said call graph actually being used.
if inline::Inline.is_enabled(&tcx.sess) {
if pm::should_run_pass(tcx, &inline::Inline) {
tcx.ensure_with_value().mir_inliner_callees(ty::InstanceDef::Item(def.to_def_id()));
}
}