From da37a70f55338ef295bb1f7a39f9ef3e407835dd Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 24 Jan 2018 09:31:56 +0000 Subject: [PATCH] re PR tree-optimization/82819 ([graphite] ICE in set_codegen_error, at graphite-isl-ast-to-gimple.c:206) 2018-01-24 Richard Biener PR tree-optimization/82819 * graphite-isl-ast-to-gimple.c (binary_op_to_tree): Avoid code generating pluses that are no-ops in the target precision. * gcc.dg/graphite/pr82819.c: New testcase. From-SVN: r257012 --- gcc/ChangeLog | 6 ++++++ gcc/graphite-isl-ast-to-gimple.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/graphite/pr82819.c | 22 ++++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/graphite/pr82819.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29177ab3d4f..12341eac44e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-01-24 Richard Biener + + PR tree-optimization/82819 + * graphite-isl-ast-to-gimple.c (binary_op_to_tree): Avoid + code generating pluses that are no-ops in the target precision. + 2018-01-24 Richard Biener PR middle-end/84000 diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 322084f30b6..89d8d941ce1 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -326,7 +326,8 @@ binary_op_to_tree (tree type, __isl_take isl_ast_expr *expr, ivs_params &ip) /* From our constraint generation we may get modulo operations that we cannot represent explicitely but that are no-ops for TYPE. Elide those. */ - if (expr_type == isl_ast_op_pdiv_r + if ((expr_type == isl_ast_op_pdiv_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)) >= TYPE_PRECISION (type))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 23fdb9fd30c..eed77ed4084 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-24 Richard Biener + + PR tree-optimization/82819 + * gcc.dg/graphite/pr82819.c: New testcase. + 2018-01-23 Paolo Carlini PR c++/83921 diff --git a/gcc/testsuite/gcc.dg/graphite/pr82819.c b/gcc/testsuite/gcc.dg/graphite/pr82819.c new file mode 100644 index 00000000000..ed4b1b6ed53 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr82819.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-nest-optimize" } */ + +short int *ts; + +void +c2 (unsigned long long int s4, int ns) +{ + short int *b2 = (short int *)&ns; + + while (ns != 0) + { + int xn; + + for (xn = 0; xn < 3; ++xn) + for (*b2 = 0; *b2 < 2; ++*b2) + s4 += xn; + if (s4 != 0) + b2 = ts; + ++ns; + } +} -- 2.30.2