public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/59019] [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561
Date: Thu, 07 Nov 2013 06:46:00 -0000	[thread overview]
Message-ID: <bug-59019-4-6jkjzJ1MM7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59019-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-11-07
                 CC|                            |ebotcazou 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> ---
This is a latent bug that the path isolation code happens to expose.

The fundamental problem is prior to combine we have the following RTL:

(insn 25 3 6 2 (set (reg/v:SI 340 [ new_i ])
        (const_int 0 [0])) j.c:225 -1
     (nil))
(insn 6 25 24 2 (set (reg:BI 343)
        (eq:BI (reg/v:SI 340 [ new_i ])
            (const_int -1 [0xffffffffffffffff]))) j.c:225 309 {*cmpsi_normal}
     (expr_list:REG_DEAD (reg/v:SI 340 [ new_i ])
        (nil)))
(insn 24 6 15 2 (trap_if (eq (reg:BI 343)
            (const_int 0 [0]))
        (const_int 0 [0])) -1
     (expr_list:REG_DEAD (reg:BI 343)
        (nil)))
(insn 15 24 16 2 (clobber (reg/i:SI 8 r8)) j.c:231 -1
     (expr_list:REG_UNUSED (reg/i:SI 8 r8)
        (nil)))


At this stage insn 24 is not considered a control flow altering insn -- it's a
conditional trap.



Combine does its thing and we end with:

(insn 24 6 15 2 (trap_if (const_int 1 [0x1])
        (const_int 0 [0])) 363 {*trap}
     (nil))
(insn 15 24 16 2 (clobber (reg/i:SI 8 r8)) j.c:231 -1
     (expr_list:REG_UNUSED (reg/i:SI 8 r8)
        (nil)))

Now insn 24 is an unconditional trap and is considered a control flow altering
insn (see Eric's change for PR29841).  Since we have a control flow altering
insn in the middle of a block, we trip the checking failure.

This seems like a pretty fundamental problem.   I can't think of any other case
where we allow optimizations to turn an insn which does not alter flow control
into a flow control altering insn (obviously we allow the opposite and it's
good).

This means that every pass which might potentially turn a conditional trap into
an unconditional trap would have to run DCE afterwards or otherwise cleanup the
code after the trap to avoid this problem.  Not good.

Or we would have to force each optimizer which might potentially turn a
conditional trap into an unconditional trap run find_many_sub_basic_blocks. 
Also not good.

Or we could hack the ia64 port in some horrid way to avoid this problem.  Even
worse.

I'm open to suggestions.


  parent reply	other threads:[~2013-11-07  6:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 10:48 [Bug rtl-optimization/59019] New: " schwab@linux-m68k.org
2013-11-06 11:39 ` [Bug rtl-optimization/59019] " rguenth at gcc dot gnu.org
2013-11-07  6:46 ` law at redhat dot com [this message]
2013-11-07  7:20 ` ebotcazou at gcc dot gnu.org
2013-11-07 17:22 ` ebotcazou at gcc dot gnu.org
2013-11-08 11:02 ` ebotcazou at gcc dot gnu.org
2013-11-08 23:15 ` steven at gcc dot gnu.org
2013-11-15 22:19 ` law at redhat dot com
2013-11-18 18:07 ` law at redhat dot com

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-59019-4-6jkjzJ1MM7@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).