re PR tree-optimization/84204 ([graphite] ICE in set_codegen_error, at graphite-isl...
authorRichard Biener <rguenther@suse.de>
Wed, 7 Feb 2018 10:14:25 +0000 (10:14 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 7 Feb 2018 10:14:25 +0000 (10:14 +0000)
2018-02-07  Richard Biener  <rguenther@suse.de>

PR tree-optimization/84204
* tree-chrec.c (chrec_fold_plus_1): Remove size limiting in
this place.

* gcc.dg/graphite/pr84204.c: New testcase.

PR tree-optimization/84205
* graphite-isl-ast-to-gimple.c (binary_op_to_tree): Also
special-case isl_ast_op_zdiv_r.

* gcc.dg/graphite/pr84205.c: New testcase.

PR tree-optimization/84223
* graphite-scop-detection.c (gather_bbs::before_dom_children):
Only add conditions from within the region.
(gather_bbs::after_dom_children): Adjust.

* gfortran.dg/graphite/pr84223.f90: New testcase.

From-SVN: r257441

gcc/ChangeLog
gcc/graphite-isl-ast-to-gimple.c
gcc/graphite-scop-detection.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr84204.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/graphite/pr84205.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/graphite/pr84223.f90 [new file with mode: 0644]
gcc/tree-chrec.c

index 7bcda10e22cb6909386a6379180f03be9c9e926c..7fc5914380650ad66a7537aca9ed60a66400361b 100644 (file)
@@ -1,3 +1,18 @@
+2018-02-07  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/84204
+       * tree-chrec.c (chrec_fold_plus_1): Remove size limiting in
+       this place.
+
+       PR tree-optimization/84205
+       * graphite-isl-ast-to-gimple.c (binary_op_to_tree): Also
+       special-case isl_ast_op_zdiv_r.
+
+       PR tree-optimization/84223
+       * graphite-scop-detection.c (gather_bbs::before_dom_children):
+       Only add conditions from within the region.
+       (gather_bbs::after_dom_children): Adjust.
+
 2018-02-07  Georg-Johann Lay  <avr@gjlay.de>
 
        PR target/84209
index 89d8d941ce1e7b4d5664e2cc6a210d79c8d6dfcf..b607b12434d0475c9035257f972023f610803dd5 100644 (file)
@@ -327,6 +327,7 @@ binary_op_to_tree (tree type, __isl_take isl_ast_expr *expr, ivs_params &ip)
      we cannot represent explicitely but that are no-ops for TYPE.
      Elide those.  */
   if ((expr_type == isl_ast_op_pdiv_r
+       || expr_type == isl_ast_op_zdiv_r
        || expr_type == isl_ast_op_add)
       && isl_ast_expr_get_type (arg_expr) == isl_ast_expr_int
       && (wi::exact_log2 (widest_int_from_isl_expr_int (arg_expr))
index 2d5dc3ec7315828e09b4866e3a1fe76aea1953f3..43716f184485c5b9e0f855f5e0ed1bb30ebe8e05 100644 (file)
@@ -1453,18 +1453,19 @@ gather_bbs::before_dom_children (basic_block bb)
        }
     }
 
-  gcond *stmt = single_pred_cond_non_loop_exit (bb);
-
-  if (stmt)
+  if (gcond *stmt = single_pred_cond_non_loop_exit (bb))
     {
       edge e = single_pred_edge (bb);
-
-      conditions.safe_push (stmt);
-
-      if (e->flags & EDGE_TRUE_VALUE)
-       cases.safe_push (stmt);
-      else
-       cases.safe_push (NULL);
+      /* Make sure the condition is in the region and thus was verified
+         to be handled.  */
+      if (e != region->region.entry)
+       {
+         conditions.safe_push (stmt);
+         if (e->flags & EDGE_TRUE_VALUE)
+           cases.safe_push (stmt);
+         else
+           cases.safe_push (NULL);
+       }
     }
 
   scop->scop_info->bbs.safe_push (bb);
@@ -1509,8 +1510,12 @@ gather_bbs::after_dom_children (basic_block bb)
 
   if (single_pred_cond_non_loop_exit (bb))
     {
-      conditions.pop ();
-      cases.pop ();
+      edge e = single_pred_edge (bb);
+      if (e != scop->scop_info->region.entry)
+       {
+         conditions.pop ();
+         cases.pop ();
+       }
     }
 }
 
index 8a0dc3c370cb58337207ef0a56103663eb77146d..8506abea04ca7f0df350d168c9e873d0963dca3c 100644 (file)
@@ -1,3 +1,14 @@
+2018-02-07  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/84204
+       * gcc.dg/graphite/pr84204.c: New testcase.
+
+       PR tree-optimization/84205
+       * gcc.dg/graphite/pr84205.c: New testcase.
+
+       PR tree-optimization/84223
+       * gfortran.dg/graphite/pr84223.f90: New testcase.
+
 2018-02-07  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/71662
diff --git a/gcc/testsuite/gcc.dg/graphite/pr84204.c b/gcc/testsuite/gcc.dg/graphite/pr84204.c
new file mode 100644 (file)
index 0000000..91401df
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O -floop-parallelize-all -fno-tree-loop-im --param scev-max-expr-size=3" } */
+
+int oc;
+
+void
+mo (int xd)
+{
+  while (xd < 1)
+    {
+      for (oc = 0; oc < 2; ++oc)
+       {
+       }
+
+      ++xd;
+    }
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/pr84205.c b/gcc/testsuite/gcc.dg/graphite/pr84205.c
new file mode 100644 (file)
index 0000000..e502eb9
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O -floop-nest-optimize -ftree-pre -fno-tree-loop-im" } */
+
+long long unsigned int od;
+int zj, fk, ea;
+
+void
+ke (void)
+{
+  if (od != 0 && zj != 0)
+    {
+      for (fk = 0; fk < 2; ++fk)
+       {
+       }
+
+      if (od == (long long unsigned int) zj)
+       zj = 0;
+
+      for (ea = 0; ea < 2; ++ea)
+       {
+       }
+    }
+}
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr84223.f90 b/gcc/testsuite/gfortran.dg/graphite/pr84223.f90
new file mode 100644 (file)
index 0000000..45b4c17
--- /dev/null
@@ -0,0 +1,3 @@
+! { dg-do compile }
+! { dg-options "-fgraphite-identity -O1 --param sccvn-max-alias-queries-per-access=0" }
+   include "../assumed_rank_bounds_2.f90"
index 896ff357842530af0c186e46715dca2ea2942f6e..04d33ef625f1959fb7e961bf212112ef7c2f76f7 100644 (file)
@@ -375,12 +375,10 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
 
        default:
          {
-           int size = 0;
-           if ((tree_contains_chrecs (op0, &size)
-                || tree_contains_chrecs (op1, &size))
-               && size < PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
+           if (tree_contains_chrecs (op0, NULL)
+               || tree_contains_chrecs (op1, NULL))
              return build2 (code, type, op0, op1);
-           else if (size < PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
+           else
              {
                if (code == POINTER_PLUS_EXPR)
                  return fold_build_pointer_plus (fold_convert (type, op0),
@@ -390,8 +388,6 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
                                      fold_convert (type, op0),
                                      fold_convert (type, op1));
              }
-           else
-             return chrec_dont_know;
          }
        }
     }