Hi Victor,

> -  if (*memory_access_type == VMAT_ELEMENTWISE
> -      || *memory_access_type == VMAT_GATHER_SCATTER_LEGACY
> -      || *memory_access_type == VMAT_STRIDED_SLP
> -      || *memory_access_type == VMAT_INVARIANT)
> +  /* Even though individual VMAT_ELEMENTWISE accesses do not cause alignment
> +     problems, loading the whole vector's worth of values in a speculative
> +     early-break context might cross a page boundary.  Set the alignment 
> scheme
> +     to `dr_aligned' here in order to force checking of whether such accesses
> +     meet alignment criteria.  */
> +  if (dr_safe_speculative_read_required (stmt_info)
> +     && !DR_SCALAR_KNOWN_BOUNDS (STMT_VINFO_DR_INFO (stmt_info))
> +      && *memory_access_type != VMAT_INVARIANT)
> +    {
> +      if (mat_gather_scatter_p (*memory_access_type)
> +       && !first_dr_info)
> +     *misalignment = DR_MISALIGNMENT_UNKNOWN;
> +      else
> +     *misalignment = dr_misalignment (first_dr_info, vectype, *poffset);
> +
> +      *alignment_support_scheme
> +     = vect_supportable_dr_alignment
> +        (vinfo, first_dr_info, vectype, *misalignment,
> +         mat_gather_scatter_p (*memory_access_type));
> +
> +      if (*alignment_support_scheme != dr_unaligned_unsupported)
> +       *alignment_support_scheme = dr_aligned;
> +    }
> +  else if (*memory_access_type == VMAT_ELEMENTWISE
> +        ||*memory_access_type == VMAT_GATHER_SCATTER_LEGACY
> +        || *memory_access_type == VMAT_STRIDED_SLP
> +        || *memory_access_type == VMAT_INVARIANT)
>      {
>        *alignment_support_scheme = dr_unaligned_supported;
>        *misalignment = DR_MISALIGNMENT_UNKNOWN;

I'm afraid the new version version isn't much clearer and I'll take blame for 
that.  What I'd go for is the hunk from v2 with the comment added and
STMT_VINFO_GATHER_SCATTER removed (or did I miss something and we do need it?).

The intent of my last comment was a separation of concerns:
The existing if-else takes care of alignment settings for individual element 
misalignment and now we're adding "block misalignment" to the mix.
IMHO, generally, block misalignment matters for every memory access type but
we don't support most of them for early break anyway.  Given that, maybe it 
doesn't really help code clarity to make this separation explicit.

What might help slightly is leaving the if-else untouched and just adding the 
v2 hunk after it, as "second pass for block-level alignment".  But that's very 
much bike-shedding at this point.

-- 
Regards
 Robin

Reply via email to