@@ -684,6 +684,8 @@ pub(crate) fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'
684684 & inline:: ForceInline ,
685685 // Perform inlining, which may add a lot of code.
686686 & inline:: Inline ,
687+ // Inlining may have introduced a lot of redundant code and a large move pattern.
688+ // Now, we need to shrink the generated MIR.
687689 // Code from other crates may have storage markers, so this needs to happen after
688690 // inlining.
689691 & remove_storage_markers:: RemoveStorageMarkers ,
@@ -695,14 +697,13 @@ pub(crate) fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'
695697 & unreachable_enum_branching:: UnreachableEnumBranching ,
696698 & unreachable_prop:: UnreachablePropagation ,
697699 & o1 ( simplify:: SimplifyCfg :: AfterUnreachableEnumBranching ) ,
698- // Inlining may have introduced a lot of redundant code and a large move pattern.
699- // Now, we need to shrink the generated MIR.
700- & ref_prop:: ReferencePropagation ,
701- & sroa:: ScalarReplacementOfAggregates ,
702700 & multiple_return_terminators:: MultipleReturnTerminators ,
703701 // After simplifycfg, it allows us to discover new opportunities for peephole
704- // optimizations.
702+ // optimizations. This invalidates CFG caches, so avoid putting between two SSA
703+ // analyses.
705704 & instsimplify:: InstSimplify :: AfterSimplifyCfg ,
705+ & ref_prop:: ReferencePropagation ,
706+ & sroa:: ScalarReplacementOfAggregates ,
706707 & simplify:: SimplifyLocals :: BeforeConstProp ,
707708 & dead_store_elimination:: DeadStoreElimination :: Initial ,
708709 & gvn:: GVN ,
0 commit comments