[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-15 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

Segher Boessenkool  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #15 from Segher Boessenkool  ---
Fixed on trunk, doesn't seem to happen on 6, closing as fixed.

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-15 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #14 from Segher Boessenkool  ---
Author: segher
Date: Sun Jan 15 17:06:00 2017
New Revision: 244477

URL: https://gcc.gnu.org/viewcvs?rev=244477=gcc=rev
Log:
Make rtl_split_edge work for jumps that fall through (PR72749)

If a jump always falls through but that cannot be optimised away, like
is the case with the PowerPC bdnz insn if its jump target is the same as
the fallthrough, sched gets confused if it schedules some instructions
from before that jump instruction to behind it: it splits the
fallthrough branch, but the jump target isn't updated, and things fall
apart as in the PR.  This patch fixes it.

The second patch fragment makes -fsched-verbose=N work for N>=4; the
currently scheduled fragment can now contain a label.  Everything else
seems to work fine with that.


PR target/72749
* cfgrtl.c (rtl_split_edge): Also patch jump insns that jump to the
fallthrough.
* haifa-sched.c (dump_insn_stream): Don't crash if there is a label
in the currently scheduled RTL fragment.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/cfgrtl.c
trunk/gcc/haifa-sched.c

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-14 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #13 from Segher Boessenkool  ---
I have a patch bootstrapping, let's not close this yet.

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-14 Thread amodra at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

Alan Modra  changed:

   What|Removed |Added

 CC|amodra at gcc dot gnu.org  |

--- Comment #12 from Alan Modra  ---
No sure whether we want to close this bug yet.  I'll leave that to Segher or
Jakub.  The patch I committed could be seen a just a workaround, unless we're
willing to say later rtl passes can count on earlier ones removing the
degenerate conditional branches that cause comment #5 problems.

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-14 Thread amodra at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #11 from Alan Modra  ---
Author: amodra
Date: Sat Jan 14 13:29:29 2017
New Revision: 244466

URL: https://gcc.gnu.org/viewcvs?rev=244466=gcc=rev
Log:
Testcase from pr72749

PR target/72749
* gcc.c-torture/compile/pr72749.c: New test.


Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr72749.c
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-14 Thread amodra at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #10 from Alan Modra  ---
Author: amodra
Date: Sat Jan 14 13:24:46 2017
New Revision: 244465

URL: https://gcc.gnu.org/viewcvs?rev=244465=gcc=rev
Log:
Avoid PR72749 by not using unspecs

Rather than using unspecs in doloop insns to stop combine creating
these insns, use legitimate_combined_insn.

PR target/72749
* combine.c (recog_for_combine_1): Set INSN_CODE before calling
target legitimate_combined_insn.
* config/rs6000/rs6000.c (TARGET_LEGITIMATE_COMBINED_INSN): Define.
(rs6000_legitimate_combined_insn): New function.
* config/rs6000/rs6000.md (UNSPEC_DOLOOP): Delete, and remove
all uses.
(ctr_internal3): Rename from *ctr_internal5.
(ctr_internal4): Rename from *ctr_internal6.
(ctr_internal1, ctr_internal2): Remove '*' from name.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c
trunk/gcc/config/rs6000/rs6000.c
trunk/gcc/config/rs6000/rs6000.md

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-12 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #9 from Segher Boessenkool  ---
(In reply to Arseny Solokha from comment #7)
> I wonder if the following ICE is somehow related to the one reported here.
> I'll file a new PR if it's not.

This is a different bug (it still happens with my candidate fix for
the original issue).

In the future, please open new bugs unless you are quite sure it is
the same issue; it is much easier and less confusing to merge bugs
than to split them.  Thanks in advance!

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-12 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #8 from Arseny Solokha  ---
int
gd (char ff)
{
  int mi;

  for (;;)
{
  ff += 59 /* 197 also works */;
  if (ff != 0)
mi = 0;
  else
return 0;
}
}

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-12 Thread asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #7 from Arseny Solokha  ---
I wonder if the following ICE is somehow related to the one reported here. I'll
file a new PR if it's not.

% powerpc-e500v2-linux-gnuspe-gcc-7.0.0-alpha20170108 -O1 -c dsmbs5u1.c
dsmbs5u1.c: In function 'gd':
dsmbs5u1.c:14:1: error: invalid rtl sharing found in the insn
 }
 ^
(insn 40 39 41 2 (set (subreg:QI (reg:SI 172) 3)
(subreg:QI (reg:SI 174) 3)) -1
 (nil))
dsmbs5u1.c:14:1: error: shared rtx
(subreg:QI (reg:SI 172) 3)
dsmbs5u1.c:14:1: internal compiler error: internal consistency failure
0x2e55cd6de9b verify_rtx_sharing
   
/var/tmp/portage/cross-powerpc-e500v2-linux-gnuspe/gcc-7.0.0_alpha20170108/work/gcc-7-20170108/gcc/emit-rtl.c:2774
0x2e55cd6ddd7 verify_rtx_sharing
   
/var/tmp/portage/cross-powerpc-e500v2-linux-gnuspe/gcc-7.0.0_alpha20170108/work/gcc-7-20170108/gcc/emit-rtl.c:2789
0x2e55cd6e30e verify_insn_sharing
   
/var/tmp/portage/cross-powerpc-e500v2-linux-gnuspe/gcc-7.0.0_alpha20170108/work/gcc-7-20170108/gcc/emit-rtl.c:2860
0x2e55cd742f7 verify_rtl_sharing()
   
/var/tmp/portage/cross-powerpc-e500v2-linux-gnuspe/gcc-7.0.0_alpha20170108/work/gcc-7-20170108/gcc/emit-rtl.c:2883
0x2e55d058785 execute_function_todo
   
/var/tmp/portage/cross-powerpc-e500v2-linux-gnuspe/gcc-7.0.0_alpha20170108/work/gcc-7-20170108/gcc/passes.c:1982
0x2e55d0595ab execute_todo
   
/var/tmp/portage/cross-powerpc-e500v2-linux-gnuspe/gcc-7.0.0_alpha20170108/work/gcc-7-20170108/gcc/passes.c:2015

% powerpc-e500v2-linux-gnuspe-gcc-7.0.0-alpha20170108 -O1 -c dsmbs5u1.c
-mcpu=power7
No ICE

% powerpc-e300c3-linux-gnu-gcc-7.0.0-alpha20170108 -O1 -c dsmbs5u1.c
No ICE

% powerpc-e300c3-linux-gnu-gcc-7.0.0-alpha20170108 -O1 -c dsmbs5u1.c -mcpu=8548
ICE

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-12 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-11 Thread amodra at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #6 from Alan Modra  ---
OK, currently testing TARGET_LEGITIMATE_COMBINED_INSN solution.  Thanks for the
analysis!

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-11 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #5 from Jakub Jelinek  ---
I think it is rtl_split_edge and patch_jump_insn not being able to deal with
such conditional jump insns.  It has code to deal e.g. with degenerate asm goto
and similar insns.  Note, I'm not really sure what should splitting an edge
mean in that case when there is just one edge.  Shall it redirect the branch so
that both when the condition is false and true the conditional jump points to
the new basic block?  Then there should be a new CODE_LABEL added to the new
basic block and the conditional jump adjusted to branch to that new CODE_LABEL.
 Or something else?

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-11 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

--- Comment #4 from Jakub Jelinek  ---
Perhaps use the TARGET_LEGITIMATE_COMBINED_INSN target hook?  Though if that
hook rejects all doloop insns, that would mean you can't combine into the
doloop insns created by the doloop pass, not sure if it wouldn't hurt though.
Without the UNSPEC, the doloop insn has been removed during the fwprop2 pass,
together with tons of other insns, while with the UNSPEC that doesn't happen.
If we want to keep the UNSPEC, then we'd need to debug whatever in the sched2
pass decides to remove the CODE_LABEL from the fallthrough block after the
degenerate doloop insn.

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-10 Thread amodra at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com,
   ||segher at gcc dot gnu.org

--- Comment #3 from Alan Modra  ---
Is there a better way to stop combine creating ctr type insns, to gain
the benefits shown in https://gcc.gnu.org/ml/gcc-patches/2016-07/msg00356.html
?

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2017-01-10 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

Jakub Jelinek  changed:

   What|Removed |Added

 CC||amodra at gcc dot gnu.org,
   ||jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Started with r238207.
So, what I see is that the loop2_doloop pass creates a strange doloop
JUMP_INSN,
which falls thru into an empty basic block whose single successor is the other
successor of the doloop insn.  During various passes that doloop insn's bb
turns into one that has just a single edge, then again 2 edges and back a
single edge, and finally during sched2 some checking ICEs on it.
Before r238207 the doloop insn didn't have UNSPEC inside of it and so has been
optimized away.

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2016-08-01 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-08-01
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Confirmed on powerpc64le.

[Bug target/72749] [7 Regression] ICE: verify_flow_info failed (error: wrong amount of branch edges after conditional jump in bb 5) w/ -O2 -fsched2-use-superblocks

2016-07-29 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72749

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |7.0