Dead-code elimination can't remove string copy insns?
Zack Weinberg
zack@codesourcery.com
Tue May 13 00:26:00 GMT 2003
On an x86 (i386-linux, -march=i386), I'm seeing this insn survive
intact from initial RTL generation all the way to final, despite the
fact that all its outputs are dead:
(insn 15 13 52 0 0x4019191c (parallel [
(set (reg:SI 62)
(const_int 0 [0x0]))
(set (reg/f:SI 59)
(plus:SI (ashift:SI (reg:SI 61)
(const_int 2 [0x2]))
(reg/f:SI 59)))
(set (reg/f:SI 60)
(plus:SI (ashift:SI (reg:SI 61)
(const_int 2 [0x2]))
(reg/f:SI 60)))
(set (mem/s:BLK (reg/f:SI 59) [4 S+0 S24 A128])
(mem/s/u:BLK (reg/f:SI 60) [1 S24 A32]))
(use (reg:SI 61))
(use (reg:SI 19 dirflag))
]) 472 {rep_movsi}
(insn_list 10 (insn_list 11 (insn_list 12 (insn_list 13 (nil)))))
(expr_list:REG_DEAD (reg:SI 19 dirflag)
(expr_list:REG_DEAD (reg:SI 61)
(expr_list:REG_UNUSED (reg:SI 62)
(expr_list:REG_UNUSED (reg/f:SI 59)
(expr_list:REG_UNUSED (reg/f:SI 60)
(nil)))))))
On an RS/6000 (rs6000-ibm-aix5, no -m switches), the same thing
happens to:
(insn 11 55 47 0 0x403a40c0 (parallel [
(set (mem/s:BLK (reg/f:SI 128) [6 S+0 S24 A128])
(mem/s/u:BLK (reg/f:SI 119) [2 S24 A32]))
(use (const_int 24 [0x18]))
(use (const_int 4 [0x4]))
(clobber (reg:SI 5 r5))
(clobber (reg:SI 6 r6))
(clobber (reg:SI 7 r7))
(clobber (reg:SI 8 r8))
(clobber (reg:SI 9 r9))
(clobber (reg:SI 10 r10))
(clobber (scratch:SI))
]) 344 {*rs6000.md:9244}
(insn_list 10 (insn_list 55 (nil)))
(expr_list:REG_DEAD (reg/f:SI 119)
(expr_list:REG_DEAD (reg/f:SI 128)
(expr_list:REG_UNUSED (reg:SI 5 r5)
(expr_list:REG_UNUSED (reg:SI 6 r6)
(expr_list:REG_UNUSED (reg:SI 7 r7)
(expr_list:REG_UNUSED (reg:SI 8 r8)
(expr_list:REG_UNUSED (reg:SI 9 r9)
(expr_list:REG_UNUSED (reg:SI 10 r10)
(expr_list:REG_UNUSED (scratch:SI)
(nil)))))))))))
Why can't anything delete these insns? I'm guessing it has something
to do with the BLKmode memory access, but the alias information should
be sufficient to see that the memory region being written into is on
the stack, and unused past this insn, hence the store is dead and can
be deleted.
Full dumps on request. The above snippets are from the .life dump.
The input file is gcc.dg/const-elim-1.c.
zw
More information about the Gcc
mailing list