public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sliao at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination
Date: Thu, 07 Jan 2010 09:19:00 -0000	[thread overview]
Message-ID: <20100107091851.3313.qmail@sourceware.org> (raw)
In-Reply-To: <bug-42494-17572@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from sliao at google dot com  2010-01-07 09:18 -------
For the trunk snapshot of 20100102, GCC 4.5.0 indeed removes most of the
redundancy. However, -O1 and -Os still produce an extra instruction, while -O2
doesn't. Do we care about an extra instruction below? Thanks.

The instruction is marked as "redundant" below.

GCC trunk's -Os:
Disassembly of section .text:
00000000 <test>:
   0:   e59f3024        ldr     r3, [pc, #36]   ; 2c <test+0x2c>
   4:   e3a02000        mov     r2, #0
   8:   e5832000        str     r2, [r3]
   c:   e59f301c        ldr     r3, [pc, #28]   ; 30 <test+0x30>
  10:   e5932000        ldr     r2, [r3]
  14:   e59f3018        ldr     r3, [pc, #24]   ; 34 <test+0x34>
  18:   e3520000        cmp     r2, #0
  1c:   13a02002        movne   r2, #2 
  20:   03a02000        moveq   r2, #0 ;redundant
  24:   e5c32000        strb    r2, [r3]
  28:   e12fff1e        bx      lr
        ...

GCC trunk's -O1:
Disassembly of section .text:
00000000 <test>:
   0:   e3a02000        mov     r2, #0
   4:   e59f3020        ldr     r3, [pc, #32]   ; 2c <test+0x2c>
   8:   e5832000        str     r2, [r3]
   c:   e59f301c        ldr     r3, [pc, #28]   ; 30 <test+0x30>
  10:   e5932000        ldr     r2, [r3]
  14:   e3520000        cmp     r2, #0
  18:   13a02002        movne   r2, #2
  1c:   03a02000        moveq   r2, #0  ;redundant
  20:   e59f300c        ldr     r3, [pc, #12]   ; 34 <test+0x34>
  24:   e5c32000        strb    r2, [r3]
  28:   e12fff1e        bx      lr
        ...

Below, GCC trunk's -O2 doesn't produce the redundant instruction.
-O2:
Disassembly of section .text:
00000000 <test>:
   0:   e59f3020        ldr     r3, [pc, #32]   ; 28 <test+0x28>
   4:   e59f2020        ldr     r2, [pc, #32]   ; 2c <test+0x2c>
   8:   e5933000        ldr     r3, [r3]
   c:   e3a01000        mov     r1, #0
  10:   e3530000        cmp     r3, #0
  14:   e5821000        str     r1, [r2]
  18:   e59f2010        ldr     r2, [pc, #16]   ; 30 <test+0x30>
  1c:   13a03002        movne   r3, #2
  20:   e5c23000        strb    r3, [r2]
  24:   e12fff1e        bx      lr
        ...


-- 

sliao at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jingyu at google dot com,
                   |                            |dougkwan at google dot com,
                   |                            |carrot at google dot com
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42494


  parent reply	other threads:[~2010-01-07  9:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-25  5:42 [Bug c/42494] New: Regression on dead-code-elimination: GCC 4.2.1 generates better code than 4.4.0 sliao at google dot com
2009-12-29 10:35 ` [Bug c/42494] [4.4 only] " ramana at gcc dot gnu dot org
2009-12-29 11:31 ` [Bug c/42494] [4.4 Regression] Missed " steven at gcc dot gnu dot org
2009-12-29 12:45 ` [Bug tree-optimization/42494] " ramana at gcc dot gnu dot org
2009-12-30 23:21 ` [Bug tree-optimization/42494] [4.4 Regression] Missed dead-code-elimination rguenth at gcc dot gnu dot org
2009-12-30 23:34 ` rguenth at gcc dot gnu dot org
2009-12-31 15:36 ` rguenth at gcc dot gnu dot org
2010-01-07  9:19 ` sliao at google dot com [this message]
2010-01-07  9:49 ` steven at gcc dot gnu dot org
2010-01-07 21:30 ` steven at gcc dot gnu dot org
2010-01-07 21:36 ` steven at gcc dot gnu dot org
2010-01-07 22:08 ` steven at gcc dot gnu dot org
2010-01-07 22:08 ` steven at gcc dot gnu dot org
2010-01-21 13:19 ` jakub at gcc dot gnu dot org
2010-02-08 16:45 ` steven at gcc dot gnu dot org
2010-04-30  8:58 ` jakub at gcc dot gnu dot org
     [not found] <bug-42494-4@http.gcc.gnu.org/bugzilla/>
2010-10-01 11:59 ` jakub at gcc dot gnu.org
2011-04-16 11:02 ` jakub at gcc dot gnu.org
2011-04-16 11:29 ` jingyu at google dot com
2011-05-13 19:46 ` lacombar at gmail dot com
2011-05-13 20:19 ` jingyu at google dot com
2011-05-13 20:51 ` lacombar at gmail dot com
2011-05-18 11:21 ` rguenth at gcc dot gnu.org
2011-05-18 11:46 ` jingyu at google dot com
2011-05-18 15:29 ` lacombar at gmail dot com
2012-03-13 16:01 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100107091851.3313.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).