public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/37922] [4.4 Regression] code generation error
Date: Tue, 16 Dec 2008 13:11:00 -0000	[thread overview]
Message-ID: <20081216130952.19977.qmail@sourceware.org> (raw)
In-Reply-To: <bug-37922-3137@http.gcc.gnu.org/bugzilla/>



------- Comment #11 from jakub at gcc dot gnu dot org  2008-12-16 13:09 -------
The problem is that CSE2 extends the live range of CC register, so before DSE1
we have in _ZN11rot_mx_infoC1ERK6rot_mx function:
(insn 15 14 16 2 pr37922.C:469 (set (reg:CC 17 flags)
        (compare:CC (reg/v:SI 75 [ proper_order ])
            (const_int 0 [0x0]))) 5 {*cmpsi_1_insn} (nil))

(jump_insn 16 15 17 2 pr37922.C:469 (set (pc)
        (if_then_else (eq (reg:CC 17 flags)
                (const_int 0 [0x0]))
            (label_ref:DI 128)
            (pc))) 618 {*jcc_1} (expr_list:REG_DEAD (reg:CC 17 flags)
        (expr_list:REG_BR_PROB (const_int 3900 [0xf3c])
            (nil))))
...
(insn 28 27 30 3 pr37922.C:472 (set (reg:SI 71 [ proper_r$den_ ])
        (mem/s/c:SI (plus:DI (reg/f:DI 20 frame)
                (const_int -60 [0xffffffffffffffc4])) [7 proper_r.den_+0 S4
A32])) 47 {*movsi_1} (nil))

(jump_insn 30 28 31 3 pr37922.C:475 (set (pc)
        (if_then_else (lt (reg:CC 17 flags)
                (const_int 0 [0x0]))
            (label_ref 35)
            (pc))) 618 {*jcc_1} (expr_list:REG_DEAD (reg:CC 17 flags)
        (expr_list:REG_BR_PROB (const_int 2700 [0xa8c])
            (nil))))

and no insn in between jump_insn 16 and 30 touch the flags register (insn 29
which was comparing (reg:SI 75) and (const_int 0) was eliminated during CSE2).

DSE in 4.3/4.4 then attempts to optimize the store of a 64-bit value in insn 27
followed by 32-bit read from the upper 32-bits of that value in insn 28, but
the
sequence it inserts for it (shift down by 32 bytes) unfortunately clobbers CC
register, but replace_read doesn't check for that.
Also, the REG_DEAD note which wasn't removed during CSE2 looks weird.
I guess in replace_read before calling validate_change we should check if insns
don't clobber or modify any hard registers that are live at that point, but am
not sure if DF is initialized for such kind of query at this point.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zadeck at gcc dot gnu dot
                   |                            |org
             Status|WAITING                     |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-16 13:09:52
               date|                            |


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


  parent reply	other threads:[~2008-12-16 13:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-26 20:12 [Bug c++/37922] New: " rwgk at yahoo dot com
2008-10-27  0:19 ` [Bug c++/37922] " pinskia at gcc dot gnu dot org
2008-10-27  2:19 ` rwgk at yahoo dot com
2008-12-07  7:35 ` rwgk at yahoo dot com
2008-12-07  7:46 ` rwgk at yahoo dot com
2008-12-13 22:10 ` rwgk at yahoo dot com
2008-12-16  0:09 ` [Bug c++/37922] [4.4 Regression] " pinskia at gcc dot gnu dot org
2008-12-16  0:10 ` pinskia at gcc dot gnu dot org
2008-12-16  2:18 ` rwgk at yahoo dot com
2008-12-16  4:03 ` hjl dot tools at gmail dot com
2008-12-16 12:09 ` jakub at gcc dot gnu dot org
2008-12-16 12:49 ` jakub at gcc dot gnu dot org
2008-12-16 13:11 ` jakub at gcc dot gnu dot org [this message]
2008-12-16 13:46 ` steven at gcc dot gnu dot org
2008-12-16 15:06 ` jakub at gcc dot gnu dot org
2008-12-16 16:01 ` [Bug c++/37922] [4.3/4.4 " hjl dot tools at gmail dot com
2008-12-16 17:20 ` hjl dot tools at gmail dot com
2008-12-16 18:42 ` hjl dot tools at gmail dot com
2008-12-16 18:45 ` zadeck at naturalbridge dot com
2008-12-17 15:47 ` hjl dot tools at gmail dot com
2008-12-17 19:02 ` rwgk at yahoo dot com
2008-12-18 13:41 ` zadeck at gcc dot gnu dot org
2008-12-18 14:26 ` zadeck at naturalbridge dot com
2008-12-18 14:34 ` hjl dot tools at gmail dot com
2008-12-29 21:34 ` [Bug c++/37922] [4.3 " rguenth at gcc dot gnu dot org
2009-01-24 10:40 ` rguenth at gcc dot gnu dot org
2009-08-04 12:43 ` rguenth at gcc dot gnu dot org
2010-05-22 18:26 ` [Bug rtl-optimization/37922] " rguenth at gcc dot gnu dot 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=20081216130952.19977.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).