https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94516
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |law at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, I see there actually two separate undesirable changes. One is that during reload_cse_regs_1 because of the cselib.c changes it optimized 3 times: -(insn 22 21 24 2 (parallel [ - (set (reg/f:DI 7 sp) - (plus:DI (reg/f:DI 7 sp) - (const_int 32 [0x20]))) - (clobber (reg:CC 17 flags)) - ]) "pr94516.c":6747:2 186 {*adddi_1} - (expr_list:REG_ARGS_SIZE (const_int 0 [0]) - (nil))) +(insn 22 21 24 2 (parallel [ + (set (reg/f:DI 7 sp) + (reg/f:DI 40 r12 [84])) + ]) "pr94516.c":6747:2 66 {*movdi_internal} + (expr_list:REG_ARGS_SIZE (const_int 0 [0]) + (nil))) That in itself isn't a wrong-code change, the question is if it is actually beneficial (maybe for -Os it could). The second change happens in the reload_cse_move2add /* Try to transform (set (REGX) (REGY)) (set (REGX) (PLUS (REGX) (CONST_INT A))) ... (set (REGX) (REGY)) (set (REGX) (PLUS (REGX) (CONST_INT B))) to (set (REGX) (REGY)) (set (REGX) (PLUS (REGX) (CONST_INT A))) ... (set (REGX) (plus (REGX) (CONST_INT B-A))) */ transformation, where REGX is sp and REGY is this r12 register that happens to contain a copy of rsp with REG_ARGS_SIZE of 0 and this one is the wrong-code one, because it ignores the fact that REGX is used in various other instructions in between.