public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Dead-code elimination can't remove string copy insns?
@ 2003-05-14 11:34 Naveen Sharma, Noida
  0 siblings, 0 replies; 18+ messages in thread
From: Naveen Sharma, Noida @ 2003-05-14 11:34 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, Michael Matz

> >> 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.
> 
> > It should, but we don't do that currently.
> 
> Do you have a sense for how hard this would be to implement?  Is it
> something that's done on tree-ssa, so there's no point adding it in
> mainline?  Will Naveen's stack-slot allocator help?

The stack pseudos rely on the flow infrastructure.
At the moment, the dead stores to the stack should be removed 
in the tail blocks (but not for BLKmode mems). 
But it should be simple to teach flow analysis to handle this 
case with stack pseudos.

Best Regards,
  Naveen Sharma.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* 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 11:34 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14 11:34 Dead-code elimination can't remove string copy insns? Naveen Sharma, Noida
  -- strict thread matches above, loose matches on Subject: below --
2003-05-13  0:26 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 22:14   ` 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).