summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-25 08:53:22 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-25 08:53:22 +0000
commita3dee266192a3a797afc5b2964199c7c5b5e6eae (patch)
treeb9754ae937355742f3fb626740515cc07bb6f513
parent0d77042c2ad88fb163923f4f06476032d5015b53 (diff)
downloadgcc-a3dee266192a3a797afc5b2964199c7c5b5e6eae.tar.gz
2015-11-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/68492 * tree-vect-slp.c (vect_build_slp_tree): Consistently build up op from scalars after operand swapping. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230855 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/tree-vect-slp.c29
2 files changed, 35 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 362f21f1a9c..28def7d3e3a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2015-11-25 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/68492
+ * tree-vect-slp.c (vect_build_slp_tree): Consistently build up
+ op from scalars after operand swapping.
+
+2015-11-25 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/68502
* tree-vect-data-refs.c (vect_analyze_group_access_1): Restore
check that the step is a multiple of the type size.
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 446ef984064..320248cff1c 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1078,6 +1078,35 @@ vect_build_slp_tree (vec_info *vinfo,
tem, npermutes, &this_tree_size,
max_tree_size))
{
+ /* If we have all children of child built up from scalars then
+ just throw that away and build it up this node from scalars. */
+ if (!SLP_TREE_CHILDREN (child).is_empty ())
+ {
+ unsigned int j;
+ slp_tree grandchild;
+
+ FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild)
+ if (grandchild != NULL)
+ break;
+ if (!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 parent vector operands from "
+ "scalars instead\n");
+ oprnd_info->def_stmts = vNULL;
+ vect_free_slp_tree (child);
+ SLP_TREE_CHILDREN (*node).quick_push (NULL);
+ continue;
+ }
+ }
+
/* ... so if successful we can apply the operand swapping
to the GIMPLE IL. This is necessary because for example
vect_get_slp_defs uses operand indexes and thus expects