* [Bug rtl-optimization/59019] [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561
2013-11-06 10:48 [Bug rtl-optimization/59019] New: [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561 schwab@linux-m68k.org
@ 2013-11-06 11:39 ` rguenth at gcc dot gnu.org
2013-11-07 6:46 ` law at redhat dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-06 11:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59019
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.9.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/59019] [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561
2013-11-06 10:48 [Bug rtl-optimization/59019] New: [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561 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
2013-11-07 7:20 ` ebotcazou at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2013-11-07 6:46 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/59019] [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561
2013-11-06 10:48 [Bug rtl-optimization/59019] New: [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561 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
@ 2013-11-07 7:20 ` ebotcazou at gcc dot gnu.org
2013-11-07 17:22 ` ebotcazou at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-11-07 7:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59019
--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> 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).
Yet the comment I added should have made it clear that I didn't invent this,
look at the CALL_INSN case just above. For example, turning a conditional
no-return call into an unconditional one will have the same effect.
> 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.
Yes, that's a generic issue with passes making things unconditional, the CFG
must be updated.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/59019] [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561
2013-11-06 10:48 [Bug rtl-optimization/59019] New: [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561 schwab@linux-m68k.org
` (2 preceding siblings ...)
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
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-11-07 17:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59019
--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> The problem I see where is we're going to have to run some kind of cleanup
> pass after each RTL pass that might make these transformations (cse, gcse,
> cprop, combine and I'm sure others). That seems quite heavyweight and bad
> from a compile-time standpoint.
>
> But I don't really see a way out. I guess I'm hoping you have other
> suggestions for how we can fix this.
Maybe declare trap_if instructions unconditionally control-flow altering? They
are probably quite rare in practice, so perhaps this wouldn't really pessimize.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/59019] [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561
2013-11-06 10:48 [Bug rtl-optimization/59019] New: [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561 schwab@linux-m68k.org
` (3 preceding siblings ...)
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
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2013-11-08 11:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59019
--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Always considering trap-if as ending a BB appears to be a bit of a rathole.
> Every time I squash one issue, another raises its head.
A little unexpected I'd say, what kind of issues does that introduce?
> I did find that combine.c already has some bits to recognize when it does
> something that may muck up the CFG and tries to compensate, it just doesn't
> hadle the situation around trap-if.
>
> I'm going to see if I can proof of concept a fix in that code. Of course
> this is a pass specific fix, but as I look deeper, more memories keep coming
> back -- we've had special code in cse.c to deal with similar situations, so
> maybe adding another case for combine isn't that bad after all.
See existing examples in split_all_insns and lra.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/59019] [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561
2013-11-06 10:48 [Bug rtl-optimization/59019] New: [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561 schwab@linux-m68k.org
` (4 preceding siblings ...)
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
7 siblings, 0 replies; 9+ messages in thread
From: steven at gcc dot gnu.org @ 2013-11-08 23:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59019
Steven Bosscher <steven at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven at gcc dot gnu.org
--- Comment #7 from Steven Bosscher <steven at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #5)
> Always considering trap-if as ending a BB appears to be a bit of a rathole.
> Every time I squash one issue, another raises its head.
Heh, I'm surprised that trap-if is not already a control flow insn.
Clearly it can alter control flow. Likewise for a conditional no-return
call.
Anyway, there are lots of places in the compiler where a transformation
results in a CFG cleanup of some sort. Before this trap-if case, my
favorite was in lower-subreg.c, where splitting a trapping load into
multiple trapping loads -- fun!
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/59019] [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561
2013-11-06 10:48 [Bug rtl-optimization/59019] New: [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561 schwab@linux-m68k.org
` (5 preceding siblings ...)
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
7 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2013-11-15 22:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59019
--- Comment #8 from Jeffrey A. Law <law at redhat dot com> ---
This has gone latent. Regardless it's relatively easy to fix things up in
combine -- which does similar kinds of things when it's able to collapse a
conditional jump to an unconditional jump and the like. I'm testing that now
(with a hack that exposes this bug again to ensure the combine.c bits get
exercised).
Basically we just have to remove the now dead insns from the block, zap the
outgoing edges and emit the barrier.
Steven, the reason conditional traps are not considered control flow altering
is that in the event of a trap, then stop execution. If the condition is
false, they carry-on. I can see both sides the "they should be considered
control flow altering" -- I'm not passionate enough about either to make a big
deal of it.
Eric, in the chaos of the last few days, I didn't save any of the spots that I
had to change to make conditional traps control flow altering. I went through
3 or 4 places that needed fixing, then decide to look at working within the
current scheme by fixing up combine...
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/59019] [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561
2013-11-06 10:48 [Bug rtl-optimization/59019] New: [4.9 regression] ICE in advance_target_bb, at sched-rgn.c:3561 schwab@linux-m68k.org
` (6 preceding siblings ...)
2013-11-15 22:19 ` law at redhat dot com
@ 2013-11-18 18:07 ` law at redhat dot com
7 siblings, 0 replies; 9+ messages in thread
From: law at redhat dot com @ 2013-11-18 18:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59019
Jeffrey A. Law <law at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #9 from Jeffrey A. Law <law at redhat dot com> ---
Trunk no longer exhibits this problem and probably wont, at least not due to
the isolation of erroneous paths optimization due to changes in that code.
There's still on issue here, but it's latent.
^ permalink raw reply [flat|nested] 9+ messages in thread