summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-04 13:31:02 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-04 13:31:02 +0000
commitf116baa1c824a0cb346e483c5e910b19321ed23d (patch)
treeb4165f54c0015b1933b734920539b2fae5aa2aaa /gcc/tree-vect-slp.c
parent47cccfda44c1685140f6769cb05433335bad998c (diff)
downloadgcc-f116baa1c824a0cb346e483c5e910b19321ed23d.tar.gz
2015-05-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/65935 * tree-vect-slp.c (vect_build_slp_tree): If we swapped operands then make sure to apply that swapping to the IL. * gcc.dg/vect/bb-slp-pr65935.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222764 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 60f257b4da9..2b8f9bde5ae 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1081,13 +1081,25 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
dump_printf (MSG_NOTE, "%d ", j);
}
dump_printf (MSG_NOTE, "\n");
- /* And try again ... */
+ /* And try again with scratch 'matches' ... */
+ bool *tem = XALLOCAVEC (bool, group_size);
if (vect_build_slp_tree (loop_vinfo, bb_vinfo, &child,
group_size, max_nunits, loads,
vectorization_factor,
- matches, npermutes, &this_tree_size,
+ tem, npermutes, &this_tree_size,
max_tree_size))
{
+ /* ... 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
+ canonical operand order. */
+ for (j = 0; j < group_size; ++j)
+ if (!matches[j])
+ {
+ gimple stmt = SLP_TREE_SCALAR_STMTS (*node)[j];
+ swap_ssa_operands (stmt, gimple_assign_rhs1_ptr (stmt),
+ gimple_assign_rhs2_ptr (stmt));
+ }
oprnd_info->def_stmts = vNULL;
SLP_TREE_CHILDREN (*node).quick_push (child);
continue;