public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/59446] New: loop2_doloop creates constant comparison and dead jump
@ 2013-12-10 11:19 olegendo at gcc dot gnu.org
  2013-12-10 22:00 ` [Bug rtl-optimization/59446] " law at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-12-10 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59446
           Summary: loop2_doloop creates constant comparison and dead jump
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olegendo at gcc dot gnu.org
                CC: law at redhat dot com
            Target: sh*-*-*

After the commit that fixed PR 58640
http://gcc.gnu.org/viewcvs?rev=203463&root=gcc&view=rev

the SH specific test case gcc.target/sh/pr51244-18.c caught the following
sequence:

.L15:
    mov    #0,r1      // r1 = 0
    tst    r1,r1      // T = r1 == 0
    bf.s    .L7        // if (T == 0) goto .L7
    add    #-4,r9

The branch above never happens and is dead code.
Something causes the loop2_doloop RTL pass to create the following code, which
results in the above final code. 

(code_label 108 107 109 4 2 "" [0 uses])
(note 109 108 110 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
      .
      .
      .
(insn 177 176 185 4 (set (reg:SI 304)
        (plus:SI (reg:SI 305)
            (const_int 1 [0x1]))) -1
     (nil))

(note 185 177 180 16 [bb 16] NOTE_INSN_BASIC_BLOCK)
(insn 180 185 182 16 (set (reg:SI 306)
        (plus:SI (reg/v:SI 278 [ k ])
            (const_int -8 [0xfffffffffffffff8]))) -1
     (nil))
(insn 182 180 183 16 (set (reg:SI 307)
        (const_int -8 [0xfffffffffffffff8])) -1
     (nil))
(insn 183 182 184 16 (set (reg:SI 147 t)
        (ge:SI (reg:SI 306)
            (reg:SI 307))) -1
     (nil))
(jump_insn 184 183 181 16 (set (pc)
        (if_then_else (eq (reg:SI 147 t)
                (const_int 0 [0]))
            (label_ref 181)
            (pc))) -1
     (int_list:REG_BR_PROB 0 (nil))
 -> 181)


(code_label 181 184 178 14 10 "" [1 uses])
(note 178 181 186 14 [bb 14] NOTE_INSN_BASIC_BLOCK)
(insn 186 178 179 14 (set (reg:SI 304)
        (const_int 1 [0x1])) -1
     (nil))

(note 179 186 155 15 [bb 15] NOTE_INSN_BASIC_BLOCK)
      .
      .
      .

      .
      .
      .

(code_label 149 146 150 9 5 "" [1 uses])
(note 150 149 151 9 [bb 9] NOTE_INSN_BASIC_BLOCK)
(insn 151 150 152 9 (set (reg/v:SI 261 [ k ])
        (plus:SI (reg/v:SI 261 [ k ])
            (const_int -8 [0xfffffffffffffff8]))) pr51244-18.c:48 68
{*addsi3_compact}
     (nil))
(insn 152 151 175 9 (set (reg:SI 147 t)
        (ge:SI (reg/v:SI 261 [ k ])
            (const_int 0 [0]))) pr51244-18.c:49 20 {cmpgesi_t}
     (nil))
(jump_insn 175 152 174 9 (parallel [
            (set (pc)
                (if_then_else (ne:SI (reg:SI 304)
                        (const_int 1 [0x1]))
                    (label_ref 174)
                    (pc)))
            (set (reg:SI 304)
                (plus (reg:SI 304)
                    (const_int -1 [0xffffffffffffffff])))
            (clobber (reg:SI 147 t))
        ]) pr51244-18.c:49 -1
     (int_list:REG_BR_PROB 9700 (nil))
 -> 174)


jump_insn 175 is SH's decrement-and-test pattern that is used for loops.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/59446] loop2_doloop creates constant comparison and dead jump
  2013-12-10 11:19 [Bug rtl-optimization/59446] New: loop2_doloop creates constant comparison and dead jump olegendo at gcc dot gnu.org
@ 2013-12-10 22:00 ` law at redhat dot com
  2013-12-10 22:17 ` olegendo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: law at redhat dot com @ 2013-12-10 22:00 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-12-10
           Assignee|unassigned at gcc dot gnu.org      |law at redhat dot com
     Ever confirmed|0                           |1

--- Comment #1 from Jeffrey A. Law <law at redhat dot com> ---
Thanks Oleg.  I see what's happening and will pull together a fix.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/59446] loop2_doloop creates constant comparison and dead jump
  2013-12-10 11:19 [Bug rtl-optimization/59446] New: loop2_doloop creates constant comparison and dead jump olegendo at gcc dot gnu.org
  2013-12-10 22:00 ` [Bug rtl-optimization/59446] " law at redhat dot com
@ 2013-12-10 22:17 ` olegendo at gcc dot gnu.org
  2013-12-11 22:15 ` law at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-12-10 22:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Thanks.  Please let me know if I can help.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/59446] loop2_doloop creates constant comparison and dead jump
  2013-12-10 11:19 [Bug rtl-optimization/59446] New: loop2_doloop creates constant comparison and dead jump olegendo at gcc dot gnu.org
  2013-12-10 22:00 ` [Bug rtl-optimization/59446] " law at redhat dot com
  2013-12-10 22:17 ` olegendo at gcc dot gnu.org
@ 2013-12-11 22:15 ` law at gcc dot gnu.org
  2013-12-11 22:16 ` law at redhat dot com
  2013-12-11 22:42 ` olegendo at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: law at gcc dot gnu.org @ 2013-12-11 22:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Author: law
Date: Wed Dec 11 22:15:14 2013
New Revision: 205905

URL: http://gcc.gnu.org/viewcvs?rev=205905&root=gcc&view=rev
Log:
    PR rtl-optimization/59446
    * tree-ssa-threadupdate.c (mark_threaded_blocks): Properly
    test for crossing a loop header.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa-threadupdate.c


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/59446] loop2_doloop creates constant comparison and dead jump
  2013-12-10 11:19 [Bug rtl-optimization/59446] New: loop2_doloop creates constant comparison and dead jump olegendo at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-12-11 22:15 ` law at gcc dot gnu.org
@ 2013-12-11 22:16 ` law at redhat dot com
  2013-12-11 22:42 ` olegendo at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: law at redhat dot com @ 2013-12-11 22:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jeffrey A. Law <law at redhat dot com> ---
Should be fixed on trunk now.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/59446] loop2_doloop creates constant comparison and dead jump
  2013-12-10 11:19 [Bug rtl-optimization/59446] New: loop2_doloop creates constant comparison and dead jump olegendo at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-12-11 22:16 ` law at redhat dot com
@ 2013-12-11 22:42 ` olegendo at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-12-11 22:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #4)
> Should be fixed on trunk now.

Yep.  The SH problem is also gone.  Thanks!


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-12-11 22:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-10 11:19 [Bug rtl-optimization/59446] New: loop2_doloop creates constant comparison and dead jump olegendo at gcc dot gnu.org
2013-12-10 22:00 ` [Bug rtl-optimization/59446] " law at redhat dot com
2013-12-10 22:17 ` olegendo at gcc dot gnu.org
2013-12-11 22:15 ` law at gcc dot gnu.org
2013-12-11 22:16 ` law at redhat dot com
2013-12-11 22:42 ` olegendo at gcc dot gnu.org

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).