From: Richard Biener Date: Tue, 29 Oct 2019 13:46:19 +0000 (+0000) Subject: re PR tree-optimization/92260 (ICE in exact_div, at poly-int.h:2162) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=318bd8c60d83ca294b237559908dd9f88ee7c300;p=gcc.git re PR tree-optimization/92260 (ICE in exact_div, at poly-int.h:2162) 2019-10-29 Richard Biener PR tree-optimization/92260 * tree-vect-slp.c (vect_get_constant_vectors): Special-case lane-reducing ops. * gcc.dg/pr92260.c: New testcase. From-SVN: r277571 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 48f562ba6aa..caaa5eeff64 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ +2019-10-29 Richard Biener + + PR tree-optimization/92260 + * tree-vect-slp.c (vect_get_constant_vectors): Special-case + lane-reducing ops. + 2019-10-29 Andre Vieira - PR 88915 + PR tree-optimization/88915 * tree-ssa-loop-niter.h (simplify_replace_tree): Change declaration. * tree-ssa-loop-niter.c (simplify_replace_tree): Add context parameter and make the valueize function pointer also take a void pointer. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f4885b6e7bd..24861e43374 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-10-29 Richard Biener + + PR tree-optimization/92260 + * gcc.dg/pr92260.c: New testcase. + 2019-10-29 Richard Biener PR tree-optimization/65930 diff --git a/gcc/testsuite/gcc.dg/pr92260.c b/gcc/testsuite/gcc.dg/pr92260.c new file mode 100644 index 00000000000..3dd34763b1f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr92260.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +extern int abs(int); +int e(const unsigned char *g, long h, unsigned char m) +{ + int i = 0; + for (int j = 0; j < h; j++) + { + for (int k = 0; k < 4; k++) + i += abs(g[k] - m); + g += h; + } + return i; +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index b75594c36e9..9d65471ae70 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -3395,10 +3395,19 @@ vect_get_constant_vectors (slp_tree op_node, slp_tree slp_node, else vector_type = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op)); - unsigned int number_of_vectors - = vect_get_num_vectors (SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node) - * TYPE_VECTOR_SUBPARTS (stmt_vectype), - vector_type); + /* ??? For lane-reducing ops we should also have the required number + of vector stmts initialized rather than second-guessing here. */ + unsigned int number_of_vectors; + if (is_gimple_assign (stmt_vinfo->stmt) + && (gimple_assign_rhs_code (stmt_vinfo->stmt) == SAD_EXPR + || gimple_assign_rhs_code (stmt_vinfo->stmt) == DOT_PROD_EXPR + || gimple_assign_rhs_code (stmt_vinfo->stmt) == WIDEN_SUM_EXPR)) + number_of_vectors = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); + else + number_of_vectors + = vect_get_num_vectors (SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node) + * TYPE_VECTOR_SUBPARTS (stmt_vectype), + vector_type); vec_oprnds->create (number_of_vectors); auto_vec voprnds (number_of_vectors);