@@ -684,6 +684,8 @@ pub(crate) fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'
684
684
& inline:: ForceInline ,
685
685
// Perform inlining, which may add a lot of code.
686
686
& 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.
687
689
// Code from other crates may have storage markers, so this needs to happen after
688
690
// inlining.
689
691
& remove_storage_markers:: RemoveStorageMarkers ,
@@ -695,14 +697,13 @@ pub(crate) fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'
695
697
& unreachable_enum_branching:: UnreachableEnumBranching ,
696
698
& unreachable_prop:: UnreachablePropagation ,
697
699
& 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 ,
702
700
& multiple_return_terminators:: MultipleReturnTerminators ,
703
701
// 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.
705
704
& instsimplify:: InstSimplify :: AfterSimplifyCfg ,
705
+ & ref_prop:: ReferencePropagation ,
706
+ & sroa:: ScalarReplacementOfAggregates ,
706
707
& simplify:: SimplifyLocals :: BeforeConstProp ,
707
708
& dead_store_elimination:: DeadStoreElimination :: Initial ,
708
709
& gvn:: GVN ,
0 commit comments