https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119155
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
There's also the issue that
inline unsigned int
vect_known_alignment_in_bytes (dr_vec_info *dr_info, tree vectype,
poly_int64 offset = 0)
{
int misalignment = dr_misalignment (dr_info, vectype, offset);
if (misalignment == DR_MISALIGNMENT_UNKNOWN)
return TYPE_ALIGN_UNIT (TREE_TYPE (DR_REF (dr_info->dr)));
is not sufficient since for packed structs the alignment isn't visible
on the field types. If we want not rely on innermost loop behavior
here we'd have to use get_object_alignment instead (I think at least
step_alignment is bogus for BB vect).
Of course that can be misleading for a group of DRs as well (for
groups we know the distance between DRs is a multiple of the DRs size).
For the case in question we simply do
ltype = build_aligned_type (ltype, TYPE_ALIGN (elem_type));
thus assuming element alignment (elem_type is derived from vectype here).
So what we kind of want here is a vect_elem_known_alignment_in_bytes.
The BB vector case is handled correctly for contiguous accesses (we don't
support variable strided "groups").