> For your proposed second pass for block-level alignment, and
> considering that this is important particularly for early break, I
> think we could quite easily absorb the logic from the V2 hunk into the
> following pre-existing section of code, making the intent of the new
> code quite clear:
>
> /* Check if we support the operation if early breaks are needed. Here we
> must ensure that we don't access any more than the scalar code would
> have. A masked operation would ensure this, so for these load types
> force masking. */
> if (loop_vinfo
> && dr_safe_speculative_read_required (stmt_info)
> && LOOP_VINFO_EARLY_BREAKS (loop_vinfo)
> ...
>
> We'd keep the existing logic contained in the appropriate
>
> if (mat_gather_scatter_p (*memory_access_type)
> || *memory_access_type == VMAT_STRIDED_SLP)
>
> block and add the new `*alignment_support_scheme = dr_unaligned_supported'
> to an `else if (*memory_access_type == VMAT_ELEMENTWISE && !inbounds)'
> block.
>
> So we'd go from
>
>
> if (loop_vinfo
> && dr_safe_speculative_read_required (stmt_info)
> && LOOP_VINFO_EARLY_BREAKS (loop_vinfo)
> && (mat_gather_scatter_p (*memory_access_type)
> || *memory_access_type == VMAT_STRIDED_SLP))
> {
> <existing logic>
> }
>
> to something like:
>
> if (loop_vinfo
> && dr_safe_speculative_read_required (stmt_info)
> && LOOP_VINFO_EARLY_BREAKS (loop_vinfo))
> {
> if (mat_gather_scatter_p (*memory_access_type)
> || *memory_access_type == VMAT_STRIDED_SLP)
> {
> <existing logic>
> }
> else if (*memory_access_type == VMAT_ELEMENTWISE && !inbounds)
> *alignment_support_scheme = dr_aligned;
> }
Yes, that seems reasonable to me.
--
Regards
Robin