My r235660 ira.c change results in some single def/single ref cases moving the def insn to just before the ref insn, that were not previously moved. Unfortunately doing so resulted in a reload problem.
The following shows a series of ia64 insns after ira, with insn 2078 (wasn't previously moved) being originally from bb 160. (insn 2078 507 518 44 (set (reg/f:DI 1381) (symbol_ref:DI ("_ZL10candidates") [flags 0x6] <var_decl 0x7f88d53c25a0 candidates>)) /src/gcc.git/gcc/tree-sra.c:324 6 {movdi_internal} (expr_list:REG_EQUIV (symbol_ref:DI ("_ZL10candidates") [flags 0x6] <var_decl 0x7f88d53c25a0 candidates>) (nil))) (insn 518 2078 524 44 (set (reg/f:DI 420 [ candidates.515_151 ]) (mem/f/c:DI (reg/f:DI 1381) [310 candidates+0 S8 A64])) /src/gcc.git/gcc/tree-sra.c:324 6 {movdi_internal} (expr_list:REG_DEAD (reg/f:DI 1381) (expr_list:REG_EQUIV (mem/f/c:DI (reg/f:DI 1381) [310 candidates+0 S8 A64]) (nil)))) ... (insn 525 509 510 44 (set (reg:DI 120 out0) (reg/f:DI 420 [ candidates.515_151 ])) /src/gcc.git/gcc/tree-sra.c:324 6 {movdi_internal} (expr_list:REG_DEAD (reg/f:DI 420 [ candidates.515_151 ]) (nil))) Of interest is the REG_DEAD and REG_EQUIV note on insn 518. Reload assigns r15 to reg 1381, but decides that reg 420 can be reloaded from its equivalent memory. The trouble is that insns between insn 518 and insn 525 also make use of r15 (not unreasonable since reg 1381 is said to be dead), so the equivalence is no longer valid. Now this equivalence was added by update_equiv_regs, under control of equiv_init_movable_p, which as the comment says (in part), allows regs "if they are not candidates for local_alloc". That was the case before moving insn 2078, but obviously not after moving it. Since it seems likely that moving these single use/def insns is beneficial due to freeing up a non-volatile reg, delete the equivalence. Bootstrapped and regression tested powerpc64le-linux. x86_64-linux regstrap in progress. I found power7 powerpc64-linux also had a bootstrap failure, cured with this patch. The patch also cures the 416.gamess failure reported for powerpc64le. OK to apply assuming no regressions show? PR rtl-optimization/70890 * ira.c (combine_and_move_insns): When moving def_insn, remove equivs on use_insn. diff --git a/gcc/ira.c b/gcc/ira.c index a38e67e..cf5be35 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -3742,6 +3742,16 @@ combine_and_move_insns (void) if (use_insn == BB_HEAD (use_bb)) BB_HEAD (use_bb) = new_insn; + /* Since regno now dies in use_insn we can't leave any + equivalence for a reg set by use_insn as the equivalence + must reference regno. */ + if (find_reg_note (use_insn, REG_EQUIV, NULL_RTX)) + { + rtx set = single_set (use_insn); + if (set && REG_P (SET_DEST (set))) + no_equiv (SET_DEST (set), set, NULL); + } + ira_reg_equiv[regno].init_insns = gen_rtx_INSN_LIST (VOIDmode, new_insn, NULL_RTX); bitmap_set_bit (cleared_regs, regno); -- Alan Modra Australia Development Lab, IBM