aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r--gcc/tree-vect-loop.cc36
1 files changed, 16 insertions, 20 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 9320bf8..50cdc2a 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -738,7 +738,6 @@ _loop_vec_info::_loop_vec_info (class loop *loop_in, vec_info_shared *shared)
nonlinear_iv (false),
ivexpr_map (NULL),
scan_map (NULL),
- slp_unrolling_factor (1),
inner_loop_cost_factor (param_vect_inner_loop_cost_factor),
vectorizable (false),
can_use_partial_vectors_p (param_vect_partial_vector_usage != 0),
@@ -2236,16 +2235,15 @@ start_over:
if (!ok)
return ok;
- /* If there are any SLP instances mark them as pure_slp. */
+ /* If there are any SLP instances mark them as pure_slp and compute
+ the overall vectorization factor. */
if (!vect_make_slp_decision (loop_vinfo))
return opt_result::failure_at (vect_location, "no stmts to vectorize.\n");
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "Loop contains only SLP stmts\n");
- /* Determine the vectorization factor from the SLP decision. */
- LOOP_VINFO_VECT_FACTOR (loop_vinfo)
- = LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo);
+ /* Dump the vectorization factor from the SLP decision. */
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location, "vectorization factor = ");
@@ -2253,12 +2251,6 @@ start_over:
dump_printf (MSG_NOTE, "\n");
}
- /* Optimize the SLP graph with the vectorization factor fixed. */
- vect_optimize_slp (loop_vinfo);
-
- /* Gather the loads reachable from the SLP graph entries. */
- vect_gather_slp_loads (loop_vinfo);
-
/* We don't expect to have to roll back to anything other than an empty
set of rgroups. */
gcc_assert (LOOP_VINFO_MASKS (loop_vinfo).is_empty ());
@@ -2273,6 +2265,12 @@ start_over:
poly_uint64 vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
gcc_assert (known_ne (vectorization_factor, 0U));
+ /* Optimize the SLP graph with the vectorization factor fixed. */
+ vect_optimize_slp (loop_vinfo);
+
+ /* Gather the loads reachable from the SLP graph entries. */
+ vect_gather_slp_loads (loop_vinfo);
+
if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) && dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
@@ -2598,7 +2596,7 @@ again:
stmt_vec_info vinfo;
vinfo = SLP_TREE_SCALAR_STMTS (SLP_INSTANCE_TREE (instance))[0];
- if (! STMT_VINFO_GROUPED_ACCESS (vinfo))
+ if (!vinfo || !STMT_VINFO_GROUPED_ACCESS (vinfo))
continue;
vinfo = DR_GROUP_FIRST_ELEMENT (vinfo);
unsigned int size = DR_GROUP_SIZE (vinfo);
@@ -7149,11 +7147,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
reduction variable. */
slp_tree *slp_op = XALLOCAVEC (slp_tree, op.num_ops);
tree *vectype_op = XALLOCAVEC (tree, op.num_ops);
- /* We need to skip an extra operand for COND_EXPRs with embedded
- comparison. */
- unsigned opno_adjust = 0;
- if (op.code == COND_EXPR && COMPARISON_CLASS_P (op.ops[0]))
- opno_adjust = 1;
+ gcc_assert (op.code != COND_EXPR || !COMPARISON_CLASS_P (op.ops[0]));
for (i = 0; i < (int) op.num_ops; i++)
{
/* The condition of COND_EXPR is checked in vectorizable_condition(). */
@@ -7163,7 +7157,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
stmt_vec_info def_stmt_info;
enum vect_def_type dt;
if (!vect_is_simple_use (loop_vinfo, slp_for_stmt_info,
- i + opno_adjust, &op.ops[i], &slp_op[i], &dt,
+ i, &op.ops[i], &slp_op[i], &dt,
&vectype_op[i], &def_stmt_info))
{
if (dump_enabled_p ())
@@ -7174,12 +7168,14 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
/* Skip reduction operands, and for an IFN_COND_OP we might hit the
reduction operand twice (once as definition, once as else). */
- if (op.ops[i] == op.ops[STMT_VINFO_REDUC_IDX (stmt_info)])
+ if (SLP_TREE_CHILDREN (slp_for_stmt_info)[i]
+ == SLP_TREE_CHILDREN
+ (slp_for_stmt_info)[SLP_TREE_REDUC_IDX (slp_for_stmt_info)])
continue;
/* There should be only one cycle def in the stmt, the one
leading to reduc_def. */
- if (VECTORIZABLE_CYCLE_DEF (dt))
+ if (SLP_TREE_CHILDREN (slp_for_stmt_info)[i]->cycle_info.id != -1)
return false;
if (!vectype_op[i])