Re: [PATCH v14 18/19] vect: Rename masked_loop_p and len_loop_p variables
Richard Biener <[email protected]> Mon, 3 Aug 2026 15:07:08 +0200
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <CAFiYyc1A9_DqkT24fDPm+DLemyfOhTF7V7wo2ab2fYi+-Nh42g@mail.gmail.com> |
On Thu, Jul 30, 2026 at 4:58 PM Christopher Bazley <[email protected]> wrote: > > These local variables existed before support for partial vectors > was added to the BB SLP vectorizer. Their loop-specific names > are no longer appropriate. Hmm, but with RVV we can have both masks and lens (not loop masks though), so a more distinctive name, maybe partial_with_mask_p and partial_with_len_p would be better. The former names are also consistently used I think, so just changing vectorizable_call does not look like an improvement. So I'd leave the names as-is, even if they are not a perfect fit now. > gcc/ChangeLog: > > * tree-vect-stmts.cc (vectorizable_call): Rename > local variables. > (vectorizable_operation): As above. > --- > gcc/tree-vect-stmts.cc | 38 ++++++++++++++++++-------------------- > 1 file changed, 18 insertions(+), 20 deletions(-) > > diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc > index 168d79c91d0..2a7b0e7dad3 100644 > --- a/gcc/tree-vect-stmts.cc > +++ b/gcc/tree-vect-stmts.cc > @@ -3836,17 +3836,16 @@ vectorizable_call (vec_info *vinfo, > scalar_dest = gimple_call_lhs (stmt); > vec_dest = vect_create_destination_var (scalar_dest, vectype_out); > > - bool masked_loop_p > + bool masks_p > = use_partial_vectors_p > && (vinfo->partial_vector_style == vect_partial_vectors_while_ult > || vinfo->partial_vector_style == vect_partial_vectors_avx512); > > - bool len_loop_p > - = use_partial_vectors_p > - && (vinfo->partial_vector_style == vect_partial_vectors_len); > + bool lens_p = use_partial_vectors_p > + && (vinfo->partial_vector_style == vect_partial_vectors_len); > > unsigned int vect_nargs = nargs; > - if (len_loop_p && (reduc_idx >= 0 || could_trap || mask_opno >= 0)) > + if (lens_p && (reduc_idx >= 0 || could_trap || mask_opno >= 0)) > { > ifn = cond_len_fn; > /* COND_* -> COND_LEN_* takes 2 extra arguments:LEN,BIAS. */ > @@ -3856,7 +3855,7 @@ vectorizable_call (vec_info *vinfo, > if (mask_opno == -1) > vect_nargs += 2; > } > - else if (masked_loop_p && mask_opno == -1 && (reduc_idx >= 0 || could_trap)) > + else if (masks_p && mask_opno == -1 && (reduc_idx >= 0 || could_trap)) > { > ifn = cond_fn; > vect_nargs += 2; > @@ -3901,11 +3900,11 @@ vectorizable_call (vec_info *vinfo, > { > int varg = 0; > /* Add the mask if necessary. */ > - if ((masked_loop_p || len_loop_p) && mask_opno == -1 > + if ((masks_p || lens_p) && mask_opno == -1 > && internal_fn_mask_index (ifn) != -1) > { > gcc_assert (internal_fn_mask_index (ifn) == varg); > - if (masked_loop_p) > + if (masks_p) > { > unsigned int vec_num = vec_oprnds0.length (); > vargs[varg++] = vect_get_mask (vinfo, gsi, vec_num, > @@ -3926,7 +3925,7 @@ vectorizable_call (vec_info *vinfo, > vargs[varg++] = vec_oprndsk[i]; > } > /* Add the else value if necessary. */ > - if ((masked_loop_p || len_loop_p) && mask_opno == -1 > + if ((masks_p || lens_p) && mask_opno == -1 > && internal_fn_else_index (ifn) != -1) > { > gcc_assert (internal_fn_else_index (ifn) == varg); > @@ -3965,7 +3964,7 @@ vectorizable_call (vec_info *vinfo, > } > else > { > - if (len_opno >= 0 && len_loop_p) > + if (len_opno >= 0 && lens_p) > { > unsigned int vec_num = vec_oprnds0.length (); > tree len = vect_get_len (vinfo, gsi, vec_num, vectype_out, > @@ -3975,7 +3974,7 @@ vectorizable_call (vec_info *vinfo, > vargs[len_opno] = len; > vargs[len_opno + 1] = bias; > } > - else if (mask_opno >= 0 && masked_loop_p) > + else if (mask_opno >= 0 && masks_p) > { > unsigned int vec_num = vec_oprnds0.length (); > tree mask = vect_get_mask (vinfo, gsi, vec_num, > @@ -6990,13 +6989,13 @@ vectorizable_operation (vec_info *vinfo, > dump_printf_loc (MSG_NOTE, vect_location, > "transform binary/unary operation.\n"); > > - bool masked_loop_p > + bool masks_p > = use_partial_vectors_p > && (vinfo->partial_vector_style == vect_partial_vectors_while_ult > || vinfo->partial_vector_style == vect_partial_vectors_avx512); > > - bool len_loop_p = use_partial_vectors_p > - && vinfo->partial_vector_style == vect_partial_vectors_len; > + bool lens_p = use_partial_vectors_p > + && vinfo->partial_vector_style == vect_partial_vectors_len; > > /* POINTER_DIFF_EXPR has pointer arguments which are vectorized as > vectors with unsigned elements, but the result is signed. So, we > @@ -7184,10 +7183,10 @@ vectorizable_operation (vec_info *vinfo, > gimple_assign_set_lhs (new_stmt, new_temp); > vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); > } > - else if ((masked_loop_p || len_loop_p) && mask_out_inactive) > + else if ((masks_p || lens_p) && mask_out_inactive) > { > tree mask; > - if (masked_loop_p) > + if (masks_p) > mask = vect_get_mask (vinfo, gsi, vec_num, vectype, i, slp_node); > else > /* Dummy mask. */ > @@ -7212,7 +7211,7 @@ vectorizable_operation (vec_info *vinfo, > (cond_fn, vectype, vops.length () - 1, &vops[1]); > vops.quick_push (else_value); > } > - if (len_loop_p) > + if (lens_p) > { > tree len = vect_get_len (vinfo, gsi, vec_num, vectype, i, 1, true, > slp_node); > @@ -7222,8 +7221,7 @@ vectorizable_operation (vec_info *vinfo, > vops.quick_push (bias); > } > gcall *call > - = gimple_build_call_internal_vec (masked_loop_p ? cond_fn > - : cond_len_fn, > + = gimple_build_call_internal_vec (masks_p ? cond_fn : cond_len_fn, > vops); > new_temp = make_ssa_name (vec_dest, call); > gimple_call_set_lhs (call, new_temp); > @@ -7239,7 +7237,7 @@ vectorizable_operation (vec_info *vinfo, > new combined mask doesn't need to be combined with a loop mask. > Not applicable to BB SLP vectorization because two SLP nodes could > have the same OP0 but different group sizes or vector types. */ > - if (loop_vinfo && masked_loop_p && code == BIT_AND_EXPR > + if (loop_vinfo && masks_p && code == BIT_AND_EXPR > && VECTOR_BOOLEAN_TYPE_P (vectype)) > { > if (loop_vinfo->scalar_cond_masked_set.contains ({ op0, vec_num })) > -- > 2.43.0 >