diff options
author | Richard Biener <rguenther@suse.de> | 2015-05-19 09:36:35 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-05-19 09:36:35 +0000 |
commit | 9626d143b96c1d860b478cd4196373b6c9428f6d (patch) | |
tree | 74ed8779cf358a8c314b9e9bf52677f36112fa68 /gcc | |
parent | d33606c30678cbccf0e95840e7dc48918ff1e21e (diff) | |
download | gcc-9626d143b96c1d860b478cd4196373b6c9428f6d.zip gcc-9626d143b96c1d860b478cd4196373b6c9428f6d.tar.gz gcc-9626d143b96c1d860b478cd4196373b6c9428f6d.tar.bz2 |
re PR tree-optimization/66165 (vect_transform_slp_perm_load: vec out of range ?)
2015-05-19 Richard Biener <rguenther@suse.de>
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr66165.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr66185.c | 13 | ||||
-rw-r--r-- | gcc/tree-vect-slp.c | 12 |
5 files changed, 54 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 46a45d4..ed64b47 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-05-19 Richard Biener <rguenther@suse.de> + + 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 <ebotcazou@adacore.com> Tristan Gingold <gingold@adacore.com> diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2853371..cffec1b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-05-19 Richard Biener <rguenther@suse.de> + + 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 <olegendo@gcc.gnu.org> 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 0000000..07407d0 --- /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 0000000..5a57ac1 --- /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 b78f7d8..cad1604 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) |