@@ -572,6 +572,8 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
572572 // Has to be done before inlining, otherwise actual call will be almost always inlined.
573573 // Also simple, so can just do first
574574 & lower_slice_len:: LowerSliceLenCalls ,
575+ // Perform instsimplify before inline to eliminate some trivial calls (like clone shims).
576+ & instsimplify:: InstSimplify :: BeforeInline ,
575577 // Perform inlining, which may add a lot of code.
576578 & inline:: Inline ,
577579 // Code from other crates may have storage markers, so this needs to happen after inlining.
@@ -591,7 +593,8 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
591593 & match_branches:: MatchBranchSimplification ,
592594 // inst combine is after MatchBranchSimplification to clean up Ne(_1, false)
593595 & multiple_return_terminators:: MultipleReturnTerminators ,
594- & instsimplify:: InstSimplify ,
596+ // After simplifycfg, it allows us to discover new opportunities for peephole optimizations.
597+ & instsimplify:: InstSimplify :: AfterSimplifyCfg ,
595598 & simplify:: SimplifyLocals :: BeforeConstProp ,
596599 & dead_store_elimination:: DeadStoreElimination :: Initial ,
597600 & gvn:: GVN ,
0 commit comments