[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-06 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #13 from Jeffrey A. Law  ---
Author: law
Date: Wed Oct  7 02:25:57 2015
New Revision: 228559

URL: https://gcc.gnu.org/viewcvs?rev=228559=gcc=rev
Log:
[PATCH][PR tree-optimization/67816] Fix jump threading when DOM removes
conditionals in jump threading path

PR tree-optimization/67816
* tree-ssa-threadupdate.h (remove_jump_threads_including): Renamed
from remove_jump_threads_starting_at.  Accept an edge rather than
a basic block.
* tree-ssa-threadupdate.c (removed_edges): New hash table.
(remove_jump_threads_including): Note edges that get removed from
the CFG for later pruning of jump threading paths including them.
(thread_through_all_blocks): Remove paths which include edges that
have been removed.
* tree-ssa-dom.c (optimize_stmt): Call remove_jump_threads_including
on each outgoing edges when optimizing away a control statement.

* gcc.c-torture/compile/pr67816.c: New test.

Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr67816.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-dom.c
trunk/gcc/tree-ssa-threadupdate.c
trunk/gcc/tree-ssa-threadupdate.h


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-06 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

Jeffrey A. Law  changed:

   What|Removed |Added

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

--- Comment #14 from Jeffrey A. Law  ---
Fixed on trunk.


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #6 from Richard Biener  ---
Reduction result looks the same.  Maybe critical is that the compiler is built
with release checking (though that would be pretty serious - code gen depending
on CHECKING)

> /gcc/spec/sb-czerny-head-64/x86_64/install-201510042000/bin/gcc -O3 iterate.i 
> -v -S
Using built-in specs.
COLLECT_GCC=/gcc/spec/sb-czerny-head-64/x86_64/install-201510042000/bin/gcc
Target: x86_64-pc-linux-gnu
Configured with: /gcc/spec/sb-czerny-head-64/gcc/configure --disable-bootstrap
--prefix=/gcc/spec/sb-czerny-head-64/x86_64/install-201510042000
--enable-languages=c,c++,fortran --enable-threads=posix --disable-nls
--enable-__cxa_atexit --enable-clocale=gnu --enable-checking=release
--disable-libstdcxx-pch --disable-libsanitizer --disable-libcilkrts
Thread model: posix
gcc version 6.0.0 20151004 (experimental) [trunk revision 228461] (GCC) 
COLLECT_GCC_OPTIONS='-O3' '-v' '-S' '-mtune=generic' '-march=x86-64'

/home/gcc/spec/sb-czerny-head-64/x86_64/install-201510042000/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.0.0/cc1
-fpreprocessed iterate.i -quiet -dumpbase iterate.i -mtune=generic
-march=x86-64 -auxbase iterate -O3 -version -o iterate.s
GNU C11 (GCC) version 6.0.0 20151004 (experimental) [trunk revision 228461]
(x86_64-pc-linux-gnu)
compiled by GNU C version 4.8.3 20141208 [gcc-4_8-branch revision
218481], GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C11 (GCC) version 6.0.0 20151004 (experimental) [trunk revision 228461]
(x86_64-pc-linux-gnu)
compiled by GNU C version 4.8.3 20141208 [gcc-4_8-branch revision
218481], GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: f102ae58a97e9c99e076c734516f015f
iterate.c: In function 'Iterate':
iterate.c:17:5: internal compiler error: in duplicate_thread_path, at
tree-ssa-threadupdate.c:2446
0xade9af duplicate_thread_path
/gcc/spec/sb-czerny-head-64/gcc/gcc/tree-ssa-threadupdate.c:2445
0xade9af thread_through_all_blocks(bool)
/gcc/spec/sb-czerny-head-64/gcc/gcc/tree-ssa-threadupdate.c:2632
0xa3c628 execute
/gcc/spec/sb-czerny-head-64/gcc/gcc/tree-ssa-dom.c:622
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #8 from Richard Biener  ---
#1  0x00ae7683 in duplicate_thread_path (
entry= 23)>, 
exit= 59)>, region=0x1b68550, n_region=10, 
region_copy=0x1b6abf0)
at /space/rguenther/src/svn/trunk/gcc/tree-ssa-threadupdate.c:2445
2445  gcc_assert (i + 1 == n_region
(gdb) p i
$1 = 6
(gdb) p n_region
$2 = 10
(gdb) p region_copy[i + 1]
$3 = 
(gdb) p single_succ_edge (bb)->dest
$4 = 


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-05 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #10 from Markus Trippelsdorf  ---
Started with r228306.


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #7 from Richard Biener  ---
Yeah, trunk configured with --enable-checking=release --enable-languages=c
--disable-bootstrap reproduces the issue for me.  Scary.


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-05 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-10-05
 CC||trippels at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #9 from Markus Trippelsdorf  ---
A bit further reduced:

int a, c, d, e;
int b[10];
void fn1() {
  int i, f = 0;
  for (;;) {
i = 0;
for (; i < a; i++)
  if (c) {
if (b[i])
  f = 1;
  } else if (b[i])
f = 0;
if (f)
  d++;
while (e)
  ;
  }
}

Confirmed on ppc64le. Only happens with checking=release.


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-05 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #11 from Jeffrey A. Law  ---
Thanks.  I've got it to fault here.  It'll be first on the list of things to do
today.


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-05 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #12 from Jeffrey A. Law  ---
As I suspected, what's happening is we've got an FSM jump thread path.   After
we register the FSM path DOM discovers that a block embedded in the path has a
control statement with a staticly computable destination.  DOM cleans things up
the obvious way.

That leaves blocks in the FSM path which become unreachable.  That in turn
triggers the checking assert.   The checking assert is a simple sanity check on
the FSM path to detect a case where a block on the path unconditionally
transferred control to another block that was not the next block on the path. 

That assert detects a "shouldn't ever happen case" and is probably totally
obsolete at this point.I'm much more concerned that this didn't trigger is
a normal development build and that's what I'm focusing my energy on at the
moment.


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-04 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #5 from rguenther at suse dot de  ---
On October 2, 2015 5:58:24 PM GMT+02:00, law at redhat dot com
 wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816
>
>--- Comment #4 from Jeffrey A. Law  ---
>I can't get it to fail either.  I've also tried running cc1 under
>valgrind to
>see if anything shows up.  Sadly nothing relevant.
>
>Richi, if this is still failing, can you get me a little context?  A
>gimple_debug_cfg (0x60) at the point of failure and anything in the DOM
>debugging dump (-fdump-whatever-details-blocks-vops)

Crafty is still ICEing on all our testers at -O3.  I'll re-reduce on Monday,
but eventually you have access to SPEC CPU 2000 as well.


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |6.0


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-02 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek  ---
I can't reproduce with the test case in Comment 1, even when I switch to that
revision.  Surely only -O3 is enough to trigger the ICE?


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-02 Thread rguenther at suse dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #3 from rguenther at suse dot de  ---
On Fri, 2 Oct 2015, mpolacek at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816
> 
> Marek Polacek  changed:
> 
>What|Removed |Added
> 
>  CC||mpolacek at gcc dot gnu.org
> 
> --- Comment #2 from Marek Polacek  ---
> I can't reproduce with the test case in Comment 1, even when I switch to that
> revision.  Surely only -O3 is enough to trigger the ICE?

On the cited rev. yes.  In my heavily patched dev tree with current
trunk it doesn't fail.  But I don't see any DOM related changes
so the issue must be at least latent.


[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-02 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #1 from Richard Biener  ---
Seen with r228349 btw.  Delta-reduced testcase:

typedef struct {
int path[65];
} CHESS_PATH;
extern int early_exit;
extern int number_of_solutions;
extern int solutions[10];
extern int solution_type;
extern int iteration_depth;
extern int hash_table_size;
extern int *last[65];
extern signed char searched_this_root_move[256];
extern unsigned int root_nodes[256];
extern CHESS_PATH pv[65];
int Iterate(int wtm, int search_type, int root_list_done)
{
  int *mvp;
  int i, value=0, time_used;
  int correct, correct_count, material=0, sorted, temp;
  for (; iteration_depth<=60; iteration_depth++) {
  for (mvp=last[0]; mvp= early_exit) break;
  do {
  sorted=1;
  for (mvp=last[0]+1; mvp

[Bug tree-optimization/67816] [6 Regression] ICE in duplicate_thread_path, 186.crafty fails to build

2015-10-02 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816

--- Comment #4 from Jeffrey A. Law  ---
I can't get it to fail either.  I've also tried running cc1 under valgrind to
see if anything shows up.  Sadly nothing relevant.

Richi, if this is still failing, can you get me a little context?  A
gimple_debug_cfg (0x60) at the point of failure and anything in the DOM
debugging dump (-fdump-whatever-details-blocks-vops)