On Thu, 25 Mar 2021, Richard Sandiford wrote:

> Richard Biener <rguent...@suse.de> writes:
> > Whether a vector DR is aligned or not depends on the vectorization
> > scheme but at the point of computing peeling for alignment
> > that has not been determined so we try to work with scalar DRs.
> >
> > For the uses by vectorizable_load/store I pondered to pass
> > the memory_access_type down to vect_supportable_dr_alignment but
> > that obviously doesn't work for peeling.
> >
> > I suppose we should delay peeling/versioning for alignment until
> > after vectorizable_load/store computes the actual vector DRs
> > and align/version those (won't versioning for alias have the
> > same issues?).
> 
> Yeah, I guess it's a bit chicken-and-egg: vectorizable_load/store
> need to know whether the operation can be aligned by peeling before
> deciding how to implement it, whereas peeling needs to know how
> vectorizable_load/store would implement something in order to
> know what alignment is needed.

Indeed.  I think it's easier to implement peeling/versioning in a
correct way if we work on vector DRs which means doing some optimistic
guessing when vectorizing loads/stores (which means _not_ going
elementwise loads/stores on targets that cannot do unaligned
accesses, but assuming we can somehow re-align them).  After
peeling we then can have a meaningful validity check of the
vector DRs, aka whether they are supported by the target.

That of couse heavily sides with "modern" targets that can do
unaligned accesses.  I suppose we don't have many left that
can't (and those do not get much vectorization anyway).

Richard.

Reply via email to