Skip shim passes if they've already been run

Looks like Generator drop shims already have `post_borrowck_cleanup` run
on them. That's a bit surprising, since it means they're getting const-
and maybe borrow-checked? This merits further investigation, but for now
just preserve the status quo.
This commit is contained in:
Dylan MacKenzie 2021-12-02 14:14:38 -08:00
parent 71dd5422ac
commit 42e31fffc4

View File

@ -75,6 +75,14 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> Body<'
}; };
debug!("make_shim({:?}) = untransformed {:?}", instance, result); debug!("make_shim({:?}) = untransformed {:?}", instance, result);
// In some of the above cases, we seem to be invoking the passes for non-shim MIR bodies.
// If that happens, there's no need to run them again.
//
// FIXME: Is this intentional?
if result.phase >= MirPhase::Const {
return result;
}
pm::run_passes( pm::run_passes(
tcx, tcx,
&mut result, &mut result,