This fixes lack of bb_loop_depth info in some of the early parts of ira, which has been the case for quite some time. All active branches return 0 from bb_loop_depth() in update_equiv_regs, but whether that actually causes mis-optimization anywhere but trunk is yet to be determined.
I played a little with trying to consolidate this loop_optimizer_init call with one that occurs a little later, but ran into ICEs. (We now have four calls to loop_optimizer_init in ira.c.) Bootstrapped and regression tested powerpc64le-linux and x86_64-linux. OK to apply? PR rtl-optimization/71275 * ira.c (ira): Call loop_optimizer_init to set up bb_loop_depth for update_equiv_regs and combine_and_move_insns. diff --git a/gcc/ira.c b/gcc/ira.c index 55b4bd7..1b269ea 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5171,6 +5171,7 @@ ira (FILE *f) ira_set_pseudo_classes (true, ira_dump_file); init_alias_analysis (); + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); reg_equiv = XCNEWVEC (struct equivalence, max_reg_num ()); update_equiv_regs (); @@ -5186,6 +5187,7 @@ ira (FILE *f) if (optimize) add_store_equivs (); + loop_optimizer_finalize (); end_alias_analysis (); free (reg_equiv); -- Alan Modra Australia Development Lab, IBM