The following fixes a graphite ICE because of a bogus assert.

Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

Richard.

2016-11-11  Richard Biener  <rguent...@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.

Index: gcc/graphite-isl-ast-to-gimple.c
===================================================================
--- gcc/graphite-isl-ast-to-gimple.c    (revision 242004)
+++ gcc/graphite-isl-ast-to-gimple.c    (working copy)
@@ -2505,9 +2505,6 @@ copy_cond_phi_nodes (basic_block bb, bas
       tree res = gimple_phi_result (phi);
       if (virtual_operand_p (res))
        continue;
-      if (is_gimple_reg (res) && scev_analyzable_p (res, region->region))
-       /* Cond phi nodes should not be scev_analyzable_p.  */
-       gcc_unreachable ();
 
       gphi *new_phi = create_phi_node (SSA_NAME_VAR (res), new_bb);
       tree new_res = create_new_def_for (res, new_phi,
Index: gcc/testsuite/gcc.dg/graphite/pr71575-1.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/pr71575-1.c   (revision 0)
+++ gcc/testsuite/gcc.dg/graphite/pr71575-1.c   (working copy)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+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);
+}
Index: gcc/testsuite/gcc.dg/graphite/pr71575-2.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/pr71575-2.c   (revision 0)
+++ gcc/testsuite/gcc.dg/graphite/pr71575-2.c   (working copy)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast -floop-nest-optimize" } */
+
+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 = (unsigned *)(__UINTPTR_TYPE__)((g && (e = d)) != f++);
+       }
+    }
+}

Reply via email to