From: Richard Biener Date: Tue, 13 Nov 2018 15:07:53 +0000 (+0000) Subject: re PR tree-optimization/87931 (ICE in vectorizable_reduction, at tree-vect-loop.c... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=41b32876b8a0b8c19b35b768f942bdad1f96f893;p=gcc.git re PR tree-optimization/87931 (ICE in vectorizable_reduction, at tree-vect-loop.c:6193 since r265876) 2018-11-13 Richard Biener PR tree-optimization/87931 * tree-vect-loop.c (vect_is_simple_reduction): Restrict nested cycles we support to latch computations vectorizable_reduction handles. * gcc.dg/graphite/pr87931.c: New testcase. From-SVN: r266075 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0b82b956ee4..f9b23f924ae 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-11-13 Richard Biener + + PR tree-optimization/87931 + * tree-vect-loop.c (vect_is_simple_reduction): Restrict + nested cycles we support to latch computations vectorizable_reduction + handles. + 2018-11-13 Martin Liska PR tree-optimization/87885 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 70d9e76834d..e61f978798e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-13 Richard Biener + + PR tree-optimization/87931 + * gcc.dg/graphite/pr87931.c: New testcase. + 2018-11-13 Martin Liska PR sanitizer/87930 diff --git a/gcc/testsuite/gcc.dg/graphite/pr87931.c b/gcc/testsuite/gcc.dg/graphite/pr87931.c new file mode 100644 index 00000000000..9ef8610ffa6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr87931.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fno-tree-copy-prop -fgraphite-identity" } */ + +#define N 40 +#define M 128 +float in[N+M]; +float coeff[M]; +float fir_out[N]; + +void fir () +{ + int i,j,k; + float diff; + + for (i = 0; i < N; i++) { + diff = 0; + for (j = 0; j < M; j++) { + diff += in[j+i]*coeff[j]; + } + fir_out[i] = diff; + } +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index a6f0b823dda..1a39b3bb4e9 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2976,6 +2976,22 @@ vect_is_simple_reduction (loop_vec_info loop_info, stmt_vec_info phi_info, if (nested_in_vect_loop && !check_reduction) { + /* FIXME: Even for non-reductions code generation is funneled + through vectorizable_reduction for the stmt defining the + PHI latch value. So we have to artificially restrict ourselves + for the supported operations. */ + switch (get_gimple_rhs_class (code)) + { + case GIMPLE_BINARY_RHS: + case GIMPLE_TERNARY_RHS: + break; + default: + /* Not supported by vectorizable_reduction. */ + if (dump_enabled_p ()) + report_vect_op (MSG_MISSED_OPTIMIZATION, def_stmt, + "nested cycle: not handled operation: "); + return NULL; + } if (dump_enabled_p ()) report_vect_op (MSG_NOTE, def_stmt, "detected nested cycle: "); return def_stmt_info;