"Kewen.Lin" <li...@linux.ibm.com> writes:
> diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
> index 490e7befea3..2a0d3b1840d 100644
> --- a/gcc/tree-vect-loop-manip.c
> +++ b/gcc/tree-vect-loop-manip.c
> @@ -412,7 +412,10 @@ vect_maybe_permute_loop_masks (gimple_seq *seq, 
> rgroup_controls *dest_rgm,
>  
>     This means that we cannot guarantee that such an induction variable
>     would ever hit a value that produces a set of all-false masks or zero
> -   lengths for RGC.  */
> +   lengths for RGC.
> +
> +   Note that please check cost modeling whether needed to be updated in
> +   function vect_estimate_min_profitable_iters if any changes.  */

Maybe:

   Note: the cost of the code generated by this function is modeled
   by vect_estimate_min_profitable_iters, so changes here may need
   corresponding changes there.  */

> […]
> diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
> index 43ec4fb04d5..dea9ca6778f 100644
> --- a/gcc/tree-vect-loop.c
> +++ b/gcc/tree-vect-loop.c
> @@ -3798,6 +3798,58 @@ vect_estimate_min_profitable_iters (loop_vec_info 
> loop_vinfo,
>        (void) add_stmt_cost (loop_vinfo, target_cost_data, num_masks - 1,
>                           vector_stmt, NULL, NULL_TREE, 0, vect_body);
>      }
> +  else if (LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo))
> +    {
> +      /* Referring to the functions vect_set_loop_condition_partial_vectors
> +      and vect_set_loop_controls_directly, we need to generate each
> +      length in the prologue and in the loop body if required. Although
> +      there are some possible optimizations, we consider the worst case
> +      here.  */
> +
> +      bool niters_known_p = LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo);
> +      bool need_iterate_p
> +     = (!LOOP_VINFO_EPILOGUE_P (loop_vinfo)
> +        && !vect_known_niters_smaller_than_vf (loop_vinfo));
> +
> +      /* Calculate how many statements to be added.  */
> +      unsigned int prologue_stmt = 0;
> +      unsigned int body_stmt = 0;

Sorry to be nit-picky, but “_stmts” reads better to me.

> […]
> @@ -4015,6 +4067,10 @@ vect_estimate_min_profitable_iters (loop_vec_info 
> loop_vinfo,
>        && min_profitable_iters < (assumed_vf + peel_iters_prologue))
>      /* We want the vectorized loop to execute at least once.  */
>      min_profitable_iters = assumed_vf + peel_iters_prologue;
> +  else if (min_profitable_iters < peel_iters_prologue)
> +    /* For LOOP_VINFO_USING_PARTIAL_VECTORS_P, we need to ensure the
> +       vectorized loop to execute at least once.  */
> +    min_profitable_iters = peel_iters_prologue;

s/to execute/executes/

> […]
> diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
> index 31af46ae19c..8550a252f44 100644
> --- a/gcc/tree-vect-stmts.c
> +++ b/gcc/tree-vect-stmts.c
> @@ -12090,7 +12090,10 @@ vect_get_vector_types_for_stmt (vec_info *vinfo, 
> stmt_vec_info stmt_info,
>     min_of_start_and_end = min (START_INDEX, END_INDEX);
>     left_len = END_INDEX - min_of_start_and_end;
>     rhs = min (left_len, LEN_LIMIT);
> -   LEN = rhs;  */
> +   LEN = rhs;
> +
> +   Note that please check cost modeling whether needed to be updated in
> +   function vect_estimate_min_profitable_iters if any changes.  */

Same suggested edit as above.

OK for the vectoriser parts with those changes, thanks.

Richard

Reply via email to