summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-18 09:39:13 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-18 09:39:13 +0000
commitc1bee668987f371617586edafa0dfccf04162a83 (patch)
treeda75024fa87089bd1e346a57d5ce2782e4667380 /gcc/tree-vect-slp.c
parent6e98053e6984aca2ff1fb00730cc30b5acb7c658 (diff)
downloadgcc-c1bee668987f371617586edafa0dfccf04162a83.tar.gz
2015-06-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/66510 * tree-vect-stmts.c (vectorizable_load): Properly compute the number of vector loads for SLP permuted loads. * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Also check the stride for loop vectorization. (vect_enhance_data_refs_alignment): Deal with SLP adjusted vectorization factor. (vect_analyze_group_access): If the group size is not a power of two require a epilogue loop. * tree-vect-loop.c (vect_analyze_loop_2): Move alignment compute and optimizing and alias test pruning after final vectorization factor computation. * tree-vect-slp.c (vect_build_slp_tree_1): Remove check on vector alignment. (vect_transform_slp_perm_load): Properly compute the original number of vector load stmts. * gcc.dg/vect/slp-perm-12.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224598 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c44
1 files changed, 10 insertions, 34 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index e44396af629..47d8a42474e 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -485,9 +485,8 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
int icode;
machine_mode optab_op2_mode;
machine_mode vec_mode;
- struct data_reference *first_dr;
HOST_WIDE_INT dummy;
- gimple first_load = NULL, prev_first_load = NULL, old_first_load = NULL;
+ gimple first_load = NULL, prev_first_load = NULL;
tree cond;
/* For every stmt in NODE find its def stmt/s. */
@@ -785,7 +784,6 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
return false;
}
- old_first_load = first_load;
first_load = GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt));
if (prev_first_load)
{
@@ -809,30 +807,6 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
}
else
prev_first_load = first_load;
-
- /* In some cases a group of loads is just the same load
- repeated N times. Only analyze its cost once. */
- if (first_load == stmt && old_first_load != first_load)
- {
- first_dr = STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt));
- if (vect_supportable_dr_alignment (first_dr, false)
- == dr_unaligned_unsupported)
- {
- if (dump_enabled_p ())
- {
- dump_printf_loc (MSG_MISSED_OPTIMIZATION,
- vect_location,
- "Build SLP failed: unsupported "
- "unaligned load ");
- dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
- stmt, 0);
- dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
- }
- /* Fatal mismatch. */
- matches[0] = false;
- return false;
- }
- }
}
} /* Grouped access. */
else
@@ -3201,6 +3175,11 @@ vect_transform_slp_perm_load (slp_tree node, vec<tree> dr_chain,
bool needs_first_vector = false;
machine_mode mode;
+ if (!STMT_VINFO_GROUPED_ACCESS (stmt_info))
+ return false;
+
+ stmt_info = vinfo_for_stmt (GROUP_FIRST_ELEMENT (stmt_info));
+
mode = TYPE_MODE (vectype);
if (!can_vec_perm_p (mode, false, NULL))
@@ -3226,8 +3205,10 @@ vect_transform_slp_perm_load (slp_tree node, vec<tree> dr_chain,
/* The number of vector stmts to generate based only on SLP_NODE_INSTANCE
unrolling factor. */
- orig_vec_stmts_num = group_size *
- SLP_INSTANCE_UNROLLING_FACTOR (slp_node_instance) / nunits;
+ orig_vec_stmts_num
+ = (STMT_VINFO_GROUP_SIZE (stmt_info)
+ * SLP_INSTANCE_UNROLLING_FACTOR (slp_node_instance)
+ + nunits - 1) / nunits;
if (orig_vec_stmts_num == 1)
only_one_vec = true;
@@ -3235,11 +3216,6 @@ vect_transform_slp_perm_load (slp_tree node, vec<tree> dr_chain,
relatively to SLP_NODE_INSTANCE unrolling factor. */
ncopies = vf / SLP_INSTANCE_UNROLLING_FACTOR (slp_node_instance);
- if (!STMT_VINFO_GROUPED_ACCESS (stmt_info))
- return false;
-
- stmt_info = vinfo_for_stmt (GROUP_FIRST_ELEMENT (stmt_info));
-
/* Generate permutation masks for every NODE. Number of masks for each NODE
is equal to GROUP_SIZE.
E.g., we have a group of three nodes with three loads from the same