From e4c7306692dbcbbbe1d7c82eac8f6a44a4c909f9 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 7 Feb 2018 10:14:25 +0000 Subject: [PATCH] re PR tree-optimization/84204 ([graphite] ICE in set_codegen_error, at graphite-isl-ast-to-gimple.c:206) 2018-02-07 Richard Biener 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 | 15 ++++++++++ gcc/graphite-isl-ast-to-gimple.c | 1 + gcc/graphite-scop-detection.c | 29 +++++++++++-------- gcc/testsuite/ChangeLog | 11 +++++++ gcc/testsuite/gcc.dg/graphite/pr84204.c | 17 +++++++++++ gcc/testsuite/gcc.dg/graphite/pr84205.c | 23 +++++++++++++++ .../gfortran.dg/graphite/pr84223.f90 | 3 ++ gcc/tree-chrec.c | 10 ++----- 8 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/graphite/pr84204.c create mode 100644 gcc/testsuite/gcc.dg/graphite/pr84205.c create mode 100644 gcc/testsuite/gfortran.dg/graphite/pr84223.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7bcda10e22c..7fc59143806 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2018-02-07 Richard Biener + + 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 PR target/84209 diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 89d8d941ce1..b607b12434d 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -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)) diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 2d5dc3ec731..43716f18448 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -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 (); + } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8a0dc3c370c..8506abea04c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2018-02-07 Richard Biener + + 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 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 index 00000000000..91401df609d --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr84204.c @@ -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 index 00000000000..e502eb9e77c --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr84205.c @@ -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 index 00000000000..45b4c1793b1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/pr84223.f90 @@ -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" diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 896ff357842..04d33ef625f 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -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; } } } -- 2.30.2