Auto merge of #85254 - cjgillot:reveal-mir, r=lcnr

Normalize MIR with RevealAll before optimizations.

Fixes #78442
This commit is contained in:
bors
2021-10-24 11:04:54 +00:00
7 changed files with 207 additions and 5 deletions

View File

@@ -66,6 +66,7 @@ mod remove_storage_markers;
mod remove_unneeded_drops;
mod remove_zsts;
mod required_consts;
mod reveal_all;
mod separate_const_switch;
mod shim;
mod simplify;
@@ -490,6 +491,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
// to them. We run some optimizations before that, because they may be harder to do on the state
// machine than on MIR with async primitives.
let optimizations_with_generators: &[&dyn MirPass<'tcx>] = &[
&reveal_all::RevealAll, // has to be done before inlining, since inlined code is in RevealAll mode.
&lower_slice_len::LowerSliceLenCalls, // has to be done before inlining, otherwise actual call will be almost always inlined. Also simple, so can just do first
&normalize_array_len::NormalizeArrayLen, // has to run after `slice::len` lowering
&unreachable_prop::UnreachablePropagation,