http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55686
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |uros at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-12-14 16:34:24 UTC --- The problem here are the local register asm vars, we have tests like !fixed_regs[DI_REG] all around the stos/etc. code, but that catches just global register asm vars, not local ones. Perhaps we should gather during expansion time or so what local register asm vars are being used in the current function, and use that along with the global vars tests. In this testcase it actually isn't a memset/memcpy, but combine combining: (insn 50 49 51 6 (parallel [ (set (reg/v/f:DI 72 [ d ]) (plus:DI (reg/v/f:DI 72 [ d ]) (const_int 8 [0x8]))) (clobber (reg:CC 17 flags)) ]) pr55686.c:10 272 {*adddi_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (nil))) ... (insn 52 51 53 6 (set (mem:DI (plus:DI (reg/v/f:DI 72 [ d ]) (const_int -8 [0xfffffffffffffff8])) [4 MEM[base: d_10, offset: -8B]+0 S8 A64]) (reg:DI 73 [ D.1766 ])) pr55686.c:10 87 {*movdi_internal_rex64} (expr_list:REG_DEAD (reg:DI 73 [ D.1766 ]) (nil))) into: (note 50 49 51 6 NOTE_INSN_DELETED) ... (insn 52 51 53 6 (parallel [ (set (mem:DI (reg/v/f:DI 72 [ d ]) [4 MEM[base: d_10, offset: -8B]+0 S8 A64]) (reg:DI 73 [ D.1766 ])) (set (reg/v/f:DI 72 [ d ]) (plus:DI (reg/v/f:DI 72 [ d ]) (const_int 8 [0x8]))) ]) pr55686.c:10 914 {*strsetdi_rex_1} (expr_list:REG_DEAD (reg:DI 73 [ D.1766 ]) (nil))) I'd say this combining is always a bad idea, there is just a single register that can be used for this, so merging it into stosl increases the register pressure. Not sure if we shouldn't reject strset* in the legitimate combine insn targhook, or modify those patterns to contain some UNSPEC somewhere so that combine just wouldn't match them, or similar. That said, local register asm ("edi") etc. might still fail with aggregate copies (or memset/memcpy/strlen/etc. calls) if expanded inline.