http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56151
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |uros at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-04 12:03:52 UTC --- Well, we already have peephole2s for MEM op= ARG (the TARGET_READ_MODIFY_WRITE guarded peephole2s), the reason why it doesn't trigger in this case is that ARG in this case ends up being a MEM, and MEM op= MEM2 isn't a valid insn: (insn 95 94 96 11 (set (reg:SI 3 bx [orig:135 D.1801 ] [135]) (mem:SI (reg/f:SI 4 si [orig:86 D.1803 ] [86]) [2 *_41+0 S4 A32])) pr56151.c:32 89 {*movsi_internal} (nil)) (insn 96 95 97 11 (parallel [ (set (reg:SI 3 bx [orig:135 D.1801 ] [135]) (ior:SI (reg:SI 3 bx [orig:135 D.1801 ] [135]) (mem:SI (plus:SI (mult:SI (reg:SI 6 bp [orig:132 D.1801 ] [132]) (const_int 4 [0x4])) (symbol_ref:SI ("setmask") <var_decl 0x7f587927a390 setmask>)) [2 setmask S4 A32]))) (clobber (reg:CC 17 flags)) ]) pr56151.c:32 421 {*iorsi_1} (expr_list:REG_DEAD (reg:SI 6 bp [orig:132 D.1801 ] [132]) (nil))) (insn 97 96 98 11 (set (mem:SI (reg/f:SI 4 si [orig:86 D.1803 ] [86]) [2 *_41+0 S4 A32]) (reg:SI 3 bx [orig:135 D.1801 ] [135])) pr56151.c:32 89 {*movsi_internal} (expr_list:REG_DEAD (reg:SI 3 bx [orig:135 D.1801 ] [135]) (expr_list:REG_DEAD (reg/f:SI 4 si [orig:86 D.1803 ] [86]) (nil)))) I guess for temp = MEM; temp op= MEM2; MEM = temp; for temp dead afterwards (this case), we could as well just add another set of the (up to 3?) peephole2's, that would transform that into temp = MEM2; MEM op= temp; instead.