scan_map (NULL),
slp_unrolling_factor (1),
single_scalar_iteration_cost (0),
- vec_outside_cost (0),
- vec_inside_cost (0),
inner_loop_cost_factor (param_vect_inner_loop_cost_factor),
vectorizable (false),
can_use_partial_vectors_p (param_vect_partial_vector_usage != 0),
/* Compute the costs by multiplying the inside costs with the factor and
add the outside costs for a more complete picture. The factor is the
amount of times we are expecting to iterate this epilogue. */
- old_cost = old_loop_vinfo->vec_inside_cost * old_factor;
- new_cost = new_loop_vinfo->vec_inside_cost * new_factor;
- old_cost += old_loop_vinfo->vec_outside_cost;
- new_cost += new_loop_vinfo->vec_outside_cost;
+ old_cost = old_loop_vinfo->vector_costs->body_cost () * old_factor;
+ new_cost = new_loop_vinfo->vector_costs->body_cost () * new_factor;
+ old_cost += old_loop_vinfo->vector_costs->outside_cost ();
+ new_cost += new_loop_vinfo->vector_costs->outside_cost ();
return new_cost < old_cost;
}
/* Check whether the (fractional) cost per scalar iteration is lower
or higher: new_inside_cost / new_vf vs. old_inside_cost / old_vf. */
- poly_int64 rel_new = new_loop_vinfo->vec_inside_cost * old_vf;
- poly_int64 rel_old = old_loop_vinfo->vec_inside_cost * new_vf;
+ poly_int64 rel_new = new_loop_vinfo->vector_costs->body_cost () * old_vf;
+ poly_int64 rel_old = old_loop_vinfo->vector_costs->body_cost () * new_vf;
HOST_WIDE_INT est_rel_new_min
= estimated_poly_value (rel_new, POLY_VALUE_MIN);
/* If there's nothing to choose between the loop bodies, see whether
there's a difference in the prologue and epilogue costs. */
- if (new_loop_vinfo->vec_outside_cost != old_loop_vinfo->vec_outside_cost)
- return new_loop_vinfo->vec_outside_cost < old_loop_vinfo->vec_outside_cost;
+ auto old_outside_cost = old_loop_vinfo->vector_costs->outside_cost ();
+ auto new_outside_cost = new_loop_vinfo->vector_costs->outside_cost ();
+ if (new_outside_cost != old_outside_cost)
+ return new_outside_cost < old_outside_cost;
return false;
}
vec_outside_cost = (int)(vec_prologue_cost + vec_epilogue_cost);
- /* Stash the costs so that we can compare two loop_vec_infos. */
- loop_vinfo->vec_inside_cost = vec_inside_cost;
- loop_vinfo->vec_outside_cost = vec_outside_cost;
-
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location, "Cost model analysis: \n");
/* Cost of a single scalar iteration. */
int single_scalar_iteration_cost;
- /* The cost of the vector prologue and epilogue, including peeled
- iterations and set-up code. */
- int vec_outside_cost;
-
- /* The cost of the vector loop body. */
- int vec_inside_cost;
-
/* The factor used to over weight those statements in an inner loop
relative to the loop being vectorized. */
unsigned int inner_loop_cost_factor;
unsigned int prologue_cost () const;
unsigned int body_cost () const;
unsigned int epilogue_cost () const;
+ unsigned int outside_cost () const;
protected:
unsigned int record_stmt_cost (stmt_vec_info, vect_cost_model_location,
return m_costs[vect_epilogue];
}
+/* Return the cost of the prologue and epilogue code (in abstract units). */
+
+inline unsigned int
+vector_costs::outside_cost () const
+{
+ return prologue_cost () + epilogue_cost ();
+}
+
#define VECT_MAX_COST 1000
/* The maximum number of intermediate steps required in multi-step type