public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Dead-code elimination can't remove string copy insns?
@ 2003-05-13  0:26 Zack Weinberg
  2003-05-13  0:48 ` Dale Johannesen
  2003-05-13  9:30 ` Michael Matz
  0 siblings, 2 replies; 18+ messages in thread
From: Zack Weinberg @ 2003-05-13  0:26 UTC (permalink / raw)
  To: gcc


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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2003-05-14  9:25 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-13  0:26 Dead-code elimination can't remove string copy insns? Zack Weinberg
2003-05-13  0:48 ` Dale Johannesen
2003-05-13  1:30   ` Zack Weinberg
2003-05-13  9:30 ` Michael Matz
2003-05-13 16:17   ` Zack Weinberg
2003-05-13 16:30     ` Diego Novillo
2003-05-13 16:40       ` Zack Weinberg
2003-05-13 17:07         ` Diego Novillo
2003-05-13 17:16           ` law
2003-05-13 17:24             ` Diego Novillo
2003-05-13 17:36           ` Zack Weinberg
2003-05-13 17:38           ` law
2003-05-13 17:50             ` Diego Novillo
2003-05-13 18:02               ` law
2003-05-13 18:35                 ` Joe Buck
2003-05-13 19:35           ` [tree-ssa] Improve eliminate_useless_stmts_and_vars [Was Re: Dead-code elimination can't remove string copy insns? ] law
2003-05-13 22:14   ` Dead-code elimination can't remove string copy insns? Richard Henderson
2003-05-14  9:25     ` Michael Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).