> -----Original Message-----
> From: Richard Biener <[email protected]>
> Sent: 17 June 2026 13:27
> To: [email protected]
> Cc: Tamar Christina <[email protected]>; [email protected]
> Subject: [PATCH 1/5] Also record ls element type for costing
>
> I've realized that on x86 we get vector types as vector composition
> element types, so just recording the ls_type isn't enough to
> realize we're constructing a V4SI from V2SI elements. The following
> adds such a field.
Yeah this becomes a lot more common with re-vectorization so NICE 😃
Thanks,
Tamar
>
> * tree-vectorizer.h (vect_load_store_data::ls_eltype): New field.
> * tree-vect-stmts.cc (vectorizable_load): Record ltype
> as ls_eltype for VMAT_STRIDED_SLP.
> (vectorizable_store): Likewise.
> ---
> gcc/tree-vect-stmts.cc | 18 ++++++++++++------
> gcc/tree-vectorizer.h | 5 ++++-
> 2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
> index 87ce2067728..4e7b45f5a6c 100644
> --- a/gcc/tree-vect-stmts.cc
> +++ b/gcc/tree-vect-stmts.cc
> @@ -8536,10 +8536,13 @@ vectorizable_store (vec_info *vinfo,
> }
>
> if (costing_p)
> - /* Record the decomposition type for target access during costing. */
> - ls.ls_type = lvectype;
> + {
> + /* Record the decomposition type for target access during costing. */
> + ls.ls_type = lvectype;
> + ls.ls_eltype = ltype;
> + }
> else
> - gcc_assert (ls.ls_type == lvectype);
> + gcc_assert (ls.ls_type == lvectype && ls.ls_eltype == ltype);
>
> unsigned align;
> if (alignment_support_scheme == dr_aligned)
> @@ -10335,10 +10338,13 @@ vectorizable_load (vec_info *vinfo,
> }
>
> if (costing_p)
> - /* Record the composition type for target access during costing. */
> - ls.ls_type = lvectype;
> + {
> + /* Record the composition type for target access during costing. */
> + ls.ls_type = lvectype;
> + ls.ls_eltype = ltype;
> + }
> else
> - gcc_assert (ls.ls_type == lvectype);
> + gcc_assert (ls.ls_type == lvectype && ls.ls_eltype == ltype);
>
> /* For SLP permutation support we need to load the whole group,
> not only the number of vector stmts the permutation result
> diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
> index 35e531c11c1..0b646d6b29e 100644
> --- a/gcc/tree-vectorizer.h
> +++ b/gcc/tree-vectorizer.h
> @@ -293,7 +293,10 @@ struct vect_load_store_data : vect_data {
> } gs;
> tree strided_offset_vectype; // VMAT_GATHER_SCATTER_IFN, originally
> strided
> /* Load/store type with larger element mode used for punning the vectype.
> */
> - tree ls_type; // VMAT_GATHER_SCATTER_IFN
> + tree ls_type; // VMAT_GATHER_SCATTER_IFN, VMAT_STRIDED_SLP
> + /* Load/store element type used for punning the vectype. Relevant when
> + that is a vector type. */
> + tree ls_eltype; // VMAT_STRIDED_SLP
> /* This is set to a supported offset vector type if we don't support the
> originally requested offset type, otherwise NULL.
> If nonzero there will be an additional offset conversion before
> --
> 2.51.0