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