From: Richard Biener Date: Tue, 19 May 2015 09:36:35 +0000 (+0000) Subject: re PR tree-optimization/66165 (vect_transform_slp_perm_load: vec out of range ?) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9626d143b96c1d860b478cd4196373b6c9428f6d;p=gcc.git re PR tree-optimization/66165 (vect_transform_slp_perm_load: vec out of range ?) 2015-05-19 Richard Biener PR tree-optimization/66165 * tree-vect-slp.c (vect_supported_load_permutation_p): Add guard for no load permutation. * gcc.dg/torture/pr66165.c: New testcase. PR tree-optimization/66185 * tree-vect-slp.c (vect_build_slp_tree): Properly roll back when building the SLP node from scalars. * gcc.dg/torture/pr66185.c: New testcase. From-SVN: r223349 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 46a45d4c15b..ed64b470784 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-05-19 Richard Biener + + PR tree-optimization/66165 + * tree-vect-slp.c (vect_supported_load_permutation_p): Add guard + for no load permutation. + + PR tree-optimization/66185 + * tree-vect-slp.c (vect_build_slp_tree): Properly roll back + when building the SLP node from scalars. + 2015-05-19 Eric Botcazou Tristan Gingold diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 28533716d91..cffec1b62db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-05-19 Richard Biener + + PR tree-optimization/66165 + * gcc.dg/torture/pr66165.c: New testcase. + + PR tree-optimization/66185 + * gcc.dg/torture/pr66185.c: New testcase. + 2015-05-19 Oleg Endo PR target/54236 diff --git a/gcc/testsuite/gcc.dg/torture/pr66165.c b/gcc/testsuite/gcc.dg/torture/pr66165.c new file mode 100644 index 00000000000..07407d05019 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr66165.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +void foo(double *d, double *a) +{ + d[0] += d[2]; + d[1] += d[3]; + d[2] += d[4]; + d[3] += d[5]; + a[0] = d[0]; + a[1] = d[1]; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr66185.c b/gcc/testsuite/gcc.dg/torture/pr66185.c new file mode 100644 index 00000000000..5a57ac1d76c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr66185.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +unsigned int a; +int b[5], c; + +int +main () +{ + for (c = 0; c < 4; c++) + b[c] = b[c+1] > ((b[0] > 0) > a); + + return 0; +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index b78f7d82d35..cad1604b438 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1103,6 +1103,16 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, scalar version. */ && !is_pattern_stmt_p (vinfo_for_stmt (stmt))) { + unsigned int j; + slp_tree grandchild; + + /* Roll back. */ + *max_nunits = old_max_nunits; + loads->truncate (old_nloads); + FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild) + vect_free_slp_tree (grandchild); + SLP_TREE_CHILDREN (child).truncate (0); + dump_printf_loc (MSG_NOTE, vect_location, "Building vector operands from scalars\n"); oprnd_info->def_stmts = vNULL; @@ -1400,6 +1410,8 @@ vect_supported_load_permutation_p (slp_instance slp_instn) no permutation is necessary. */ FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node) { + if (!SLP_TREE_LOAD_PERMUTATION (node).exists ()) + continue; bool subchain_p = true; next_load = NULL; FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), j, load)