This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PRs 84204, 84205 and 84223
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 7 Feb 2018 11:12:42 +0100 (CET)
- Subject: [PATCH] Fix PRs 84204, 84205 and 84223
- Authentication-results: sourceware.org; auth=none
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
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.
Index: gcc/tree-chrec.c
===================================================================
--- gcc/tree-chrec.c (revision 257382)
+++ gcc/tree-chrec.c (working copy)
@@ -375,12 +375,10 @@ chrec_fold_plus_1 (enum tree_code code,
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,
fold_convert (type, op0),
fold_convert (type, op1));
}
- else
- return chrec_dont_know;
}
}
}
Index: gcc/testsuite/gcc.dg/graphite/pr84204.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/pr84204.c (nonexistent)
+++ gcc/testsuite/gcc.dg/graphite/pr84204.c (working copy)
@@ -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;
+ }
+}
2018-02-07 Richard Biener <rguenther@suse.de>
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.
Index: gcc/graphite-isl-ast-to-gimple.c
===================================================================
--- gcc/graphite-isl-ast-to-gimple.c (revision 257382)
+++ gcc/graphite-isl-ast-to-gimple.c (working copy)
@@ -327,6 +327,7 @@ binary_op_to_tree (tree type, __isl_take
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: gcc/testsuite/gcc.dg/graphite/pr84205.c
===================================================================
--- gcc/testsuite/gcc.dg/graphite/pr84205.c (nonexistent)
+++ gcc/testsuite/gcc.dg/graphite/pr84205.c (working copy)
@@ -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)
+ {
+ }
+ }
+}
2018-02-07 Richard Biener <rguenther@suse.de>
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.
Index: gcc/graphite-scop-detection.c
===================================================================
--- gcc/graphite-scop-detection.c (revision 257382)
+++ gcc/graphite-scop-detection.c (working copy)
@@ -1453,18 +1453,19 @@ gather_bbs::before_dom_children (basic_b
}
}
- 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_bl
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: gcc/testsuite/gfortran.dg/graphite/pr84223.f90
===================================================================
--- gcc/testsuite/gfortran.dg/graphite/pr84223.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/graphite/pr84223.f90 (working copy)
@@ -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"