public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/46315] [4.5 Regression] gcc-4.5.1 -O2 -fno-strict-overflow causes bad code generation
Date: Sun, 14 Nov 2010 11:38:00 -0000	[thread overview]
Message-ID: <bug-46315-4-kuw3xN0RjI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46315-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2010-11-14 11:34:42 UTC ---
The problem is indeed the note, but I don't think it comes from it being sort
of self-referential.  The use of reg 83 in the note doesn't make it live so ce1
merges BB 4 just before insn 75:


(note 19 18 22 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn 22 19 23 4 pr43615.c:10 (set (reg:SI 86)
        (sign_extend:SI (mem:QI (plus:SI (reg/v/f:SI 83 [ s ])
                    (const_int 1 [0x1])) [0 S1 A8]))) 96 {extendqisi2}
(expr_list:REG_DEAD (reg/v/f:SI 73 [ s ])
        (nil)))

(insn 23 22 24 4 pr43615.c:10 (parallel [
            (set (reg/v:SI 81 [ d ])
                (plus:SI (reg:SI 86)
                    (const_int -48 [0xffffffd0])))
            (clobber (reg:CC 17 flags))
        ]) 197 {*addsi_1} (expr_list:REG_DEAD (reg:SI 86)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

(insn 24 23 25 4 pr43615.c:11 (set (reg:CC 17 flags)
        (compare:CC (reg/v:SI 81 [ d ])
            (const_int 9 [0x9]))) 6 {*cmpsi_1} (nil))

(jump_insn 25 24 26 4 pr43615.c:11 (set (pc)
        (if_then_else (gtu (reg:CC 17 flags)
                (const_int 0 [0x0]))
            (label_ref:SI 68)
            (pc))) 464 {*jcc_1} (expr_list:REG_DEAD (reg:CC 17 flags)
        (expr_list:REG_BR_PROB (const_int 450 [0x1c2])
            (nil)))
 -> 68)

(note 26 25 75 5 [bb 5] NOTE_INSN_BASIC_BLOCK)

(insn 75 26 29 5 pr43615.c:10 (set (reg/v/f:SI 83 [ s ])
        (reg/f:SI 95 [ s ])) -1 (expr_list:REG_EQUAL (plus:SI (reg/v/f:SI 83 [
s ])
            (const_int 2 [0x2]))
        (nil)))


with BB 11:


(note 67 68 5 11 [bb 11] NOTE_INSN_BASIC_BLOCK)

(insn 5 67 72 11 pr43615.c:12 (set (reg/v/f:SI 83 [ s ])
        (const_int 0 [0x0])) 44 {*movsi_1} (nil))


yielding:


(note 19 18 22 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(insn 22 19 23 4 pr43615.c:10 (set (reg:SI 86)
        (sign_extend:SI (mem:QI (plus:SI (reg/v/f:SI 83 [ s ])
                    (const_int 1 [0x1])) [0 S1 A8]))) 96 {extendqisi2}
(expr_list:REG_DEAD (reg/v/f:SI 73 [ s ])
        (nil)))

(insn 23 22 5 4 pr43615.c:10 (parallel [
            (set (reg/v:SI 81 [ d ])
                (plus:SI (reg:SI 86)
                    (const_int -48 [0xffffffd0])))
            (clobber (reg:CC 17 flags))
        ]) 197 {*addsi_1} (expr_list:REG_DEAD (reg:SI 86)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

(insn 5 23 24 4 pr43615.c:12 (set (reg/v/f:SI 83 [ s ])
        (const_int 0 [0x0])) 44 {*movsi_1} (nil))

(insn 24 5 25 4 pr43615.c:11 (set (reg:CC 17 flags)
        (compare:CC (reg/v:SI 81 [ d ])
            (const_int 9 [0x9]))) 6 {*cmpsi_1} (nil))

(jump_insn 25 24 26 4 pr43615.c:11 (set (pc)
        (if_then_else (gtu (reg:CC 17 flags)
                (const_int 0 [0x0]))
            (label_ref:SI 46)
            (pc))) 464 {*jcc_1} (expr_list:REG_DEAD (reg:CC 17 flags)
        (expr_list:REG_BR_PROB (const_int 450 [0x1c2])
            (nil)))
 -> 46)

(insn 75 26 29 5 pr43615.c:10 (set (reg/v/f:SI 83 [ s ])
        (reg/f:SI 95 [ s ])) -1 (expr_list:REG_EQUAL (plus:SI (reg/v/f:SI 83 [
s ])
            (const_int 2 [0x2]))
        (nil)))


and insn 5 now feeds the note.


  parent reply	other threads:[~2010-11-14 11:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-05 16:27 [Bug c/46315] New: " zorry at gentoo dot org
2010-11-05 16:43 ` [Bug tree-optimization/46315] [4.5 Regression] " rguenth at gcc dot gnu.org
2010-11-05 16:47 ` rguenth at gcc dot gnu.org
2010-11-09  4:50 ` dirtyepic at gentoo dot org
2010-11-12 15:47 ` rguenth at gcc dot gnu.org
2010-11-13 19:48 ` [Bug rtl-optimization/46315] " rguenth at gcc dot gnu.org
2010-11-13 22:29 ` ebotcazou at gcc dot gnu.org
2010-11-14 11:38 ` ebotcazou at gcc dot gnu.org [this message]
2010-11-16  0:42 ` [Bug rtl-optimization/46315] [4.5 regression] -O2 -fno-strict-overflow causes wrong " ebotcazou at gcc dot gnu.org
2010-11-16 22:15 ` ebotcazou at gcc dot gnu.org
2010-11-16 22:18 ` ebotcazou at gcc dot gnu.org
2010-11-16 22:22 ` ebotcazou 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-46315-4-kuw3xN0RjI@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).