public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "steven at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/56151] [4.8 Regression] Performance degradation after r194054 on x86 Atom.
Date: Sun, 03 Feb 2013 00:46:00 -0000	[thread overview]
Message-ID: <bug-56151-4-MrcdW47xDK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56151-4@http.gcc.gnu.org/bugzilla/>


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-02-03
                 CC|steven at gcc dot gnu.org   |
     Ever Confirmed|0                           |1

--- Comment #3 from Steven Bosscher <steven at gcc dot gnu.org> 2013-02-03 00:45:37 UTC ---
Confirmed.

My patch only avoids situations that ought not to happen in the first
place: self-referencing REG_EQUAL notes.  If this somehow prevents an
interesting code transformation I don't consider it my responsibility
to find out what that might be. Therefore I'm not taking this bug.

I did look at the difference in generated code. The regression is due
to the optabs.c change, reverting it results in the pre-r194054 code
again. The difference in code from the 'expand' pass is:

    86: NOTE_INSN_BASIC_BLOCK 13
    87: {r130:SI=r60:SI>>0x5;clobber flags:CC;}
    88: {r131:SI=r130:SI<<0x2;clobber flags:CC;}
    89: {r86:SI=r103:SI+r131:SI;clobber flags:CC;}
    90: {r132:SI=r60:SI&0x1f;clobber flags:CC;}
    91: r133:SI=`setmask'
-   92: r134:SI=[r132:SI*0x4+r133:SI]
-   93: {[r86:SI]=[r86:SI]|r134:SI;clobber flags:CC;}
+   94: r136:SI=[r132:SI*0x4+r133:SI]
+   95: r137:SI=[r86:SI]
+   96: {r135:SI=r137:SI|r136:SI;clobber flags:CC;}
+   97: [r86:SI]=r135:SI
       REG_EQUAL [r86:SI]|[r132:SI*0x4+r133:SI]
    // next basic block

The '+' code is the post-patch code, '-' is pre-patch (the continuous
numbering is due to the '-' code being rejected post-past, so those two
insn UIDs are lost).

Post-patch the extra moves of insns 95 and 97 are never cleaned up. The
extra move is introduced to make room for the REG_EQUAL note that is 
self-referencing in the pre-patch situation (SET of r86 with REG_EQUAL
note using r86). So the pre-patch RTL was indeed invalid.

Combine fails to restore the code to its pre-patch state because it
combines:

   94: r136:SI=[r132:SI*0x4+`setmask']
   95: r137:SI=[r86:SI]
   96: {r135:SI=r137:SI|r136:SI;clobber flags:CC;}

to:

   95: r137:SI=[r86:SI]
   96: {r135:SI=r137:SI|[r132:SI*0x4+`setmask'];clobber flags:CC;}

and the 'setmask' reference make merging the SET of r135 and the store
impossible:

Trying 96 -> 97:
Failed to match this instruction:
(parallel [
        (set (mem:SI (reg/f:SI 86 [ D.1803 ]) [2 *_41+0 S4 A32])
            (ior:SI (reg:SI 137 [ *_41 ])
                (mem:SI (plus:SI (mult:SI (reg:SI 132 [ D.1801 ])
                            (const_int 4 [0x4]))
                        (symbol_ref:SI ("setmask") <var_decl 0x7ffff63fb390
setmask>)) [2 setmaskD.1732 S4 A32])))
        (clobber (reg:CC 17 flags))
    ])
Failed to match this instruction:
(set (mem:SI (reg/f:SI 86 [ D.1803 ]) [2 *_41+0 S4 A32])
    (ior:SI (reg:SI 137 [ *_41 ])
        (mem:SI (plus:SI (mult:SI (reg:SI 132 [ D.1801 ])
                    (const_int 4 [0x4]))
                (symbol_ref:SI ("setmask") <var_decl 0x7ffff63fb390 setmask>))
[2 setmaskD.1732 S4 A32])))


  parent reply	other threads:[~2013-02-03  0:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30 15:18 [Bug tree-optimization/56151] New: " ysrumyan at gmail dot com
2013-01-30 15:20 ` [Bug tree-optimization/56151] " ysrumyan at gmail dot com
2013-01-30 16:04 ` [Bug rtl-optimization/56151] " rguenth at gcc dot gnu.org
2013-01-31  9:24 ` [Bug rtl-optimization/56151] [4.8 Regression] " rguenth at gcc dot gnu.org
2013-02-03  0:46 ` steven at gcc dot gnu.org [this message]
2013-02-03  1:05 ` steven at gcc dot gnu.org
2013-02-04 10:34 ` ebotcazou at gcc dot gnu.org
2013-02-04 12:04 ` jakub at gcc dot gnu.org
2013-02-04 17:14 ` jakub at gcc dot gnu.org
2013-02-04 17:59 ` steven at gcc dot gnu.org
2013-02-04 18:20 ` jakub at gcc dot gnu.org
2013-02-08 15:23 ` rguenth at gcc dot gnu.org
2013-02-08 15:29 ` jakub at gcc dot gnu.org
2013-02-11 15:42 ` jakub at gcc dot gnu.org
2013-02-12 10:38 ` jakub at gcc dot gnu.org
2013-02-12 10:39 ` 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=bug-56151-4-MrcdW47xDK@http.gcc.gnu.org/bugzilla/ \
    --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).