public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amonakov at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/39794] [4.4/4.5 Regression] Miscompile with -O2 -funroll-loops
Date: Fri, 17 Apr 2009 21:55:00 -0000	[thread overview]
Message-ID: <20090417215520.15794.qmail@sourceware.org> (raw)
In-Reply-To: <bug-39794-13999@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from amonakov at gcc dot gnu dot org  2009-04-17 21:55 -------
I attempted to investigate the miscompilation on the 4.4 branch.
The problem seems to appear in dse2 pass.  Basically, after encountering

  313 dx:DI=ax:DI+0x4
  187 {[di:DI+dx:DI]=[di:DI+dx:DI]<<0x1;clobber flags:CC;}
...
  191 [di:DI+dx:DI+0x4]=cx:SI
  314 dx:DI=ax:DI+0x8
  200 {[di:DI+dx:DI]=[di:DI+dx:DI]<<0x1;clobber flags:CC;}

and upon considering insn 200, dse2 decides to delete insn 191 and protect insn
187 (both are wrong, 200 depends on 191 and 187 is irrelevant):

**scanning insn=200
  mem: (plus:DI (reg/v/f:DI 5 di [orig:63 a ] [63])
    (reg:DI 1 dx [orig:84 ivtmp.36 ] [84]))
expanding: r5 into: NULL
expanding: r1 into: (plus:DI (value:DI)
    (const_int 8 [0x8]))
expanding value DI into: r0
expanding: r0 into: NULL

   after cselib_expand address: (plus:DI (plus:DI (reg/v/f:DI 5 di [orig:63 a ]
[63])
        (reg:DI 0 ax [orig:76 ivtmp.36 ] [76]))
    (const_int 8 [0x8]))

   after canon_rtx address: (plus:DI (plus:DI (reg/v/f:DI 5 di [orig:63 a ]
[63])
        (reg:DI 0 ax [orig:76 ivtmp.36 ] [76]))
    (const_int 8 [0x8]))
  varying cselib base=67 offset = 8
 processing cselib load mem:(mem:SI (plus:DI (reg/v/f:DI 5 di [orig:63 a ]
[63])
        (reg:DI 1 dx [orig:84 ivtmp.36 ] [84])) [2 S4 A32])
 processing cselib load against insn 191
 processing cselib load against insn 187
removing from active insn=187 has store
  mem: (plus:DI (reg/v/f:DI 5 di [orig:63 a ] [63])
    (reg:DI 1 dx [orig:84 ivtmp.36 ] [84]))
expanding: r5 into: NULL
expanding: r1 into: (plus:DI (value:DI)
    (const_int 8 [0x8]))
expanding value DI into: r0
expanding: r0 into: NULL

   after cselib_expand address: (plus:DI (plus:DI (reg/v/f:DI 5 di [orig:63 a ]
[63])
        (reg:DI 0 ax [orig:76 ivtmp.36 ] [76]))
    (const_int 8 [0x8]))

   after canon_rtx address: (plus:DI (plus:DI (reg/v/f:DI 5 di [orig:63 a ]
[63])
        (reg:DI 0 ax [orig:76 ivtmp.36 ] [76]))
    (const_int 8 [0x8]))
  varying cselib base=67 offset = 8
 processing cselib store [8..12)
    trying store in insn=191 gid=-1[8..12)
Locally deleting insn 191
deferring deletion of insn with uid = 191.
mems_found = 1, cannot_delete = false


I wonder how dse2 is supposed to notice that insn 314 changes DX.  E.g. when
checking rhs of insn 200 ([di+dx]) against lhs of insn 191 ([di+dx+4] for
different dx) in check_mem_read_rtx it calls canon_true_dependence (from
dse.c:2224) for [di+dx] and [di+dx+4] which returns false.  However, these
references clearly conflict.  Maybe a stupid question, but shouldn't this
canon_true_dependence call receive canonicalized MEMs from 'base' and
'store_info->cse_base'?


-- 

amonakov at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gmail dot com,
                   |                            |amonakov at gcc dot gnu dot
                   |                            |org


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


  parent reply	other threads:[~2009-04-17 21:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17  9:58 [Bug middle-end/39794] New: " abel at gcc dot gnu dot org
2009-04-17 10:27 ` [Bug middle-end/39794] [4.4/4.5 Regression] " amonakov at gcc dot gnu dot org
2009-04-17 10:35 ` rguenth at gcc dot gnu dot org
2009-04-17 11:43 ` jakub at gcc dot gnu dot org
2009-04-17 12:19 ` rguenth at gcc dot gnu dot org
2009-04-17 21:55 ` amonakov at gcc dot gnu dot org [this message]
2009-04-17 22:06 ` rguenth at gcc dot gnu dot org
2009-04-20 15:48 ` bonzini at gnu dot org
2009-04-20 17:46 ` jakub at gcc dot gnu dot org
2009-04-21 16:02 ` jakub at gcc dot gnu dot org
2009-04-21 17:23 ` jakub at gcc dot gnu dot org
2009-04-22 13:41 ` rguenth at gcc dot gnu dot org
2009-04-22 16:55 ` alexey dot zaytsev at gmail dot com
2009-04-22 16:58 ` alexey dot zaytsev at gmail dot com
2009-04-23 14:37 ` bonzini at gnu dot org
2009-04-24  6:58 ` [Bug rtl-optimization/39794] " jakub at gcc dot gnu dot org
2009-04-27 11:55 ` jakub at gcc dot gnu dot org
2009-04-27 12:49 ` jakub 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=20090417215520.15794.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).