Bug 71575 - [6 Regression] [graphite] internal compiler error: in copy_cond_phi_nodes, at graphite-isl-ast-to-gimple.c:2500
Summary: [6 Regression] [graphite] internal compiler error: in copy_cond_phi_nodes, at...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 6.1.0
: P2 normal
Target Milestone: 6.3
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
: 71380 (view as bug list)
Depends on:
Blocks: graphite
  Show dependency treegraph
 
Reported: 2016-06-18 00:09 UTC by Aric Belsito
Modified: 2016-12-09 08:45 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 7.0
Known to fail: 6.2.0
Last reconfirmed: 2016-07-07 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aric Belsito 2016-06-18 00:09:27 UTC
Reduced Testcase:
void w(int x, double *y)
{
    int i, j;
    double a;
    double c[32];

    for (i = 0; i < x; i++) {
        for (j = 0; j < x - i; j++) {
            c[j] = y[i];
        }
        y[i] = a;
        a += c[0] + y[i];
    }
}

void v(int x, double *y)
{
    w(x, y);
}

on amd64 with -O2 -floop-nest-optimize

test.c: In function 'w':
test.c:1:6: internal compiler error: in copy_cond_phi_nodes, at graphite-isl-ast-to-gimple.c:2500
 void w(int x, double *y)
      ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

I have the pull request from pr69068 applied.
Comment 1 Aric Belsito 2016-06-18 00:14:48 UTC
Forgot this in OP:

$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-gentoo-linux-musl/gcc-bin/6.1.0/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-gentoo-linux-musl/6.1.0/lto-wrapper
Target: x86_64-gentoo-linux-musl
Configured with: /var/tmp/portage/sys-devel/gcc-6.1.0/work/gcc-6.1.0/configure --host=x86_64-gentoo-linux-musl --build=x86_64-gentoo-linux-musl --prefix=/usr --bindir=/usr/x86_64-gentoo-linux-musl/gcc-bin/6.1.0 --includedir=/usr/lib/gcc/x86_64-gentoo-linux-musl/6.1.0/include --datadir=/usr/share/gcc-data/x86_64-gentoo-linux-musl/6.1.0 --mandir=/usr/share/gcc-data/x86_64-gentoo-linux-musl/6.1.0/man --infodir=/usr/share/gcc-data/x86_64-gentoo-linux-musl/6.1.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-gentoo-linux-musl/6.1.0/include/g++-v6 --with-python-dir=/share/gcc-data/x86_64-gentoo-linux-musl/6.1.0/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror
--with-system-zlib --enable-nls --without-included-gettext --disable-symvers libat_cv_have_ifunc=no --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 6.1.0 p1.1' --enable-esp --enable-libstdcxx-time --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-multilib --with-multilib-list=m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libmpx --disable-vtable-verify --disable-libvtv --enable-lto --with-isl --disable-isl-version-check --disable-libsanitizer --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 6.1.0 (Gentoo Hardened 6.1.0 p1.1)
Comment 2 Martin Liška 2016-07-07 09:20:06 UTC
Confirmed, I'm adding also GCC 4.9 branches where it:
sorry, unimplemented: Graphite loop optimizations cannot be used
Comment 3 Richard Biener 2016-08-03 12:06:00 UTC
(In reply to Martin Liška from comment #2)
> Confirmed, I'm adding also GCC 4.9 branches where it:
> sorry, unimplemented: Graphite loop optimizations cannot be used

this just means you didn't have the graphite prerequesites and it was disabled at compile-time.
Comment 4 Richard Biener 2016-08-22 08:34:29 UTC
GCC 6.2 is being released, adjusting target milestone.
Comment 5 Richard Biener 2016-08-22 08:35:34 UTC
GCC 6.2 is being released, adjusting target milestone.
Comment 6 Richard Biener 2016-08-22 08:59:12 UTC
GCC 6.2 is being released, adjusting target milestone.
Comment 7 Richard Biener 2016-08-22 09:00:43 UTC
GCC 6.2 is being released, adjusting target milestone.
Comment 8 Richard Biener 2016-11-11 08:12:04 UTC
We run into

#1  0x000000000175ce2f in translate_isl_ast_to_gimple::copy_cond_phi_nodes (
    this=0x7fffffffd9a0, bb=<basic_block 0x7ffff6891410 (6)>, 
    new_bb=<basic_block 0x7ffff69d1138 (33)>, iv_map=...)
    at /space/rguenther/src/svn/gcc-6-branch/gcc/graphite-isl-ast-to-gimple.c:2498
2498            gcc_unreachable ();
(gdb) l
2493          tree res = gimple_phi_result (phi);
2494          if (virtual_operand_p (res))
2495            continue;
2496          if (is_gimple_reg (res) && scev_analyzable_p (res, region->region))
2497            /* Cond phi nodes should not be scev_analyzable_p.  */
2498            gcc_unreachable ();
2499
2500          gphi *new_phi = create_phi_node (SSA_NAME_VAR (res), new_bb);
2501          tree new_res = create_new_def_for (res, new_phi,
2502                                             gimple_phi_result_ptr (new_phi));

the issue went latent on the trunk.
Comment 9 Richard Biener 2016-11-11 08:15:01 UTC
I believe the assertion is simply bogus -- some condition PHIs _can_ be analyzed by SCEV.  Removing the assert "fixes" the testcase.
Comment 10 Richard Biener 2016-11-11 08:22:18 UTC
*** Bug 71380 has been marked as a duplicate of this bug. ***
Comment 11 Richard Biener 2016-11-11 08:23:02 UTC
Testcase from the duplicate (ICEs on trunk)

int *a;
int b, c, d, e, g;
char f;

void fn1() {
  for (; c;) {
    b = 0;
    for (; b <= 2; b++) {
      unsigned **h = (unsigned **) &a[b];
      *h = (g && (e = d)) != f++;
    }
  }
}

on aarch64 with -Ofast -floop-interchange.
Comment 12 Richard Biener 2016-11-11 12:54:57 UTC
Author: rguenth
Date: Fri Nov 11 12:54:25 2016
New Revision: 242069

URL: https://gcc.gnu.org/viewcvs?rev=242069&root=gcc&view=rev
Log:
2016-11-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71575
	* graphite-isl-ast-to-gimple.c (copy_cond_phi_nodes): Remove
	bogus assert.

	* gcc.dg/graphite/pr71575-1.c: New testcase.
	* gcc.dg/graphite/pr71575-2.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/graphite/pr71575-1.c
    trunk/gcc/testsuite/gcc.dg/graphite/pr71575-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/graphite-isl-ast-to-gimple.c
    trunk/gcc/testsuite/ChangeLog
Comment 13 Richard Biener 2016-11-11 12:55:16 UTC
Fixed on trunk sofar.
Comment 14 Richard Biener 2016-12-09 08:44:23 UTC
Author: rguenth
Date: Fri Dec  9 08:43:50 2016
New Revision: 243475

URL: https://gcc.gnu.org/viewcvs?rev=243475&root=gcc&view=rev
Log:
2016-12-09  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2016-11-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/78542
	* tree-ssa-ccp.c (evaluate_stmt): Only valueize simplification
	if allowed.

	* gcc.dg/torture/pr78542.c: New testcase.

	2016-11-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/78482
	* tree-cfgcleanup.c: Include tree-ssa-loop-niter.h.
	(remove_forwarder_block_with_phi): When merging with a loop
	header creates a new latch reset number of iteration information
	of the loop.

	* gcc.dg/torture/pr78482.c: New testcase.

	2016-11-23  Richard Biener  <rguenther@suse.de>

	PR middle-end/71762
	* match.pd ((~X & Y) -> X < Y, (X & ~Y) -> Y < X,
	(~X | Y) -> X <= Y, (X | ~Y) -> Y <= X): Remove.

	* gcc.dg/torture/pr71762-1.c: New testcase.
	* gcc.dg/torture/pr71762-2.c: Likewise.
	* gcc.dg/torture/pr71762-3.c: Likewise.
	* gcc.dg/tree-ssa/forwprop-28.c: XFAIL.

	2016-11-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71575
	* graphite-isl-ast-to-gimple.c (copy_cond_phi_nodes): Remove
	bogus assert.

	* gcc.dg/graphite/pr71575-1.c: New testcase.
	* gcc.dg/graphite/pr71575-2.c: Likewise.

	2016-11-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/78224
	* tree-call-cdce.c (shrink_wrap_one_built_in_call_with_conds):
	Split the fallthru edge in case its successor may have PHIs.

	* g++.dg/torture/pr78224.C: New testcase.

	2016-11-05  David Edelsohn  <dje.gcc@gmail.com>
		Richard Biener  <rguenther@suse.de>

	PR bootstrap/78188
	PR c++/71848
	* ipa-comdats.c (pass_ipa_comdats::gate): Require HAVE_COMDAT_GROUP.

	* g++.dg/ipa/pr78188.C: New test.

	2016-09-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77646
	* tree-ssa-sccvn.c (visit_reference_op_call): Always value-number
	a VDEF.

	* gcc.dg/torture/pr77646.c: New testcase.

Added:
    branches/gcc-6-branch/gcc/testsuite/g++.dg/ipa/pr78188.C
    branches/gcc-6-branch/gcc/testsuite/g++.dg/torture/pr78224.C
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/graphite/pr71575-1.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/graphite/pr71575-2.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr71762-1.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr71762-2.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr71762-3.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr77646.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr78482.c
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr78542.c
Modified:
    branches/gcc-6-branch/gcc/ChangeLog
    branches/gcc-6-branch/gcc/graphite-isl-ast-to-gimple.c
    branches/gcc-6-branch/gcc/ipa-comdats.c
    branches/gcc-6-branch/gcc/match.pd
    branches/gcc-6-branch/gcc/testsuite/ChangeLog
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/tree-ssa/forwprop-28.c
    branches/gcc-6-branch/gcc/tree-call-cdce.c
    branches/gcc-6-branch/gcc/tree-cfgcleanup.c
    branches/gcc-6-branch/gcc/tree-ssa-ccp.c
    branches/gcc-6-branch/gcc/tree-ssa-sccvn.c
Comment 15 Richard Biener 2016-12-09 08:45:05 UTC
Fixed.