@@ -571,6 +571,8 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
571
571
// Has to be done before inlining, otherwise actual call will be almost always inlined.
572
572
// Also simple, so can just do first
573
573
& lower_slice_len:: LowerSliceLenCalls ,
574
+ // Perform instsimplify before inline to eliminate some trivial calls (like clone shims).
575
+ & instsimplify:: InstSimplify :: BeforeInline ,
574
576
// Perform inlining, which may add a lot of code.
575
577
& inline:: Inline ,
576
578
// 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>) {
590
592
& match_branches:: MatchBranchSimplification ,
591
593
// inst combine is after MatchBranchSimplification to clean up Ne(_1, false)
592
594
& multiple_return_terminators:: MultipleReturnTerminators ,
593
- & instsimplify:: InstSimplify ,
595
+ // After simplifycfg, it allows us to discover new opportunities for peephole optimizations.
596
+ & instsimplify:: InstSimplify :: AfterSimplifyCfg ,
594
597
& simplify:: SimplifyLocals :: BeforeConstProp ,
595
598
& dead_store_elimination:: DeadStoreElimination :: Initial ,
596
599
& gvn:: GVN ,
0 commit comments