This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR66185
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 19 May 2015 11:24:25 +0200 (CEST)
- Subject: [PATCH] Fix PR66185
- Authentication-results: sourceware.org; auth=none
I forgot to roll back SLP child state when ending up building vectors
from scalars.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2015-05-19 Richard Biener <rguenther@suse.de>
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.
Index: gcc/tree-vect-slp.c
===================================================================
*** gcc/tree-vect-slp.c (revision 223288)
--- gcc/tree-vect-slp.c (working copy)
*************** vect_build_slp_tree (loop_vec_info loop_
*** 1103,1108 ****
--- 1103,1118 ----
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;
Index: gcc/testsuite/gcc.dg/torture/pr66185.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr66185.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr66185.c (working copy)
***************
*** 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;
+ }