Hi Victor,

> -      if ((vf.is_constant () && pow2p_hwi (new_alignment.to_constant ()))
> -       || (!vf.is_constant () && pow2p_hwi (align_factor_c)))
> +      if ((vf.is_constant () && !pow2p_hwi (new_alignment.to_constant ()))
> +       || (!vf.is_constant () && !pow2p_hwi (align_factor_c)))
> +     new_alignment
> +       = HOST_WIDE_INT_1U << ceil_log2 (new_alignment.to_constant ());

Is this safe when !vf.is_constant ()?  I.e. with new_alignment = vf * ... won't 
to_constant () fail?

> -  if (*memory_access_type == VMAT_ELEMENTWISE
> -      || *memory_access_type == VMAT_GATHER_SCATTER_LEGACY
> +  if (*memory_access_type == VMAT_ELEMENTWISE)
> +    {
> +      if (dr_safe_speculative_read_required (stmt_info)
> +       && !STMT_VINFO_GATHER_SCATTER_P (stmt_info)
> +       && !DR_SCALAR_KNOWN_BOUNDS (STMT_VINFO_DR_INFO (stmt_info)))
> +     *alignment_support_scheme = dr_unaligned_unsupported;
> +      else
> +     *alignment_support_scheme = dr_unaligned_supported;
> +      *misalignment = DR_MISALIGNMENT_UNKNOWN;
> +    }
> +
> +  else if (*memory_access_type == VMAT_GATHER_SCATTER_LEGACY
>        || *memory_access_type == VMAT_STRIDED_SLP
>        || *memory_access_type == VMAT_INVARIANT)
>      {

Not being fully acquainted with the early-break flow, I'm not exactly sure 
what's happening here.  Won't setting the alignment to dr_unaligned_unsupported 
just going to cause a "return false" soon after?  If so, can't we fold the 
check into the early-break checks we already have (around line 2564), thus 
making it slightly more explicit?

BTW not related to your patch at all but I noticed that we have

  /* Scatter-gather and invariant accesses continue to address individual
     scalars, so vector-level alignment is irrelevant.  */
  if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)
      || integer_zerop (DR_STEP (dr_info->dr)))
    return false;

in vect_relevant_for_alignment_p and that's not universally true anymore :/


-- 
Regards
 Robin

Reply via email to