Re: [PATCH] D17268: [LAA] Function 'isStridedPtr' returns additional result “Loop *Lp” via function argument and add appropriate checks out of the 'isStridedPtr'.

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 12:13:03 PDT 2016


hfinkel added a comment.

In http://reviews.llvm.org/D17268#437021, @roman.shirokiy wrote:

> In http://reviews.llvm.org/D17268#433986, @anemet wrote:
>
> > In http://reviews.llvm.org/D17268#433960, @hfinkel wrote:
> >
> > > In http://reviews.llvm.org/D17268#432173, @anemet wrote:
> > >
> > > > In http://reviews.llvm.org/D17268#426175, @roman.shirokiy wrote:
> > > >
> > > > > Updated diff according to Adam suggestions. Also added negative unit stride check since it seems to not break anything and allows to vectorize
> > > >
> > > >
> > > > Can you please not change this for now.  I have been thinking about this code and I am not sure I understand the original version either.
> > > >
> > > > Particularly unclear is why we only check non-wrapping when we retry proving vectorization safety with memchecks only.  It seems to me that we'd have to do that for any pointer participating in memchecks.
> > > >
> > > > @Hal, do you remember this?  I asked Arnold and he didn't remember anymore.
> > >
> > >
> > > I don't in detail, but would the SCEV simplify in the first place if the expression might wrap? When we have memchecks we force the non-wrapping, and so we need to check.
> >
> >
> > Right but non-wrapping should be true for any memcheck not just those that we use instead of the failed SCEV-based testing.  E.g. in
> >
> > for (i) {
> >
> >   A[i] = B[i];
> >
> > }
> >
> > we will insert memchecks right away (i.e. ShouldCheckStride=false) but we should first make sure that the pointers don't wrap.
>
>
> Hi Adam!
>
> Can we check for non-wrapping only in case if we already have memchecks, but Accesses.isDependencyCheckNeeded() is somehow false? If it is true then non-wrapping is checked in isDependent, as far as I understand. If it is false then we can traverse through participating pointers and check them for non-wrapping (with isNoWrap maybe), and if any one of them wraps then report that there is unsafe dependent memory operations i.e. CanVecMem = false.


Hopefully, in almost all such cases in practice, SCEV itself will be able to prove nowrap on the pointer-expression AddRec. Also, FWIW, if we need to do this, we might want to do it as part of support for alignment-based multiversioning (because in the case where the pointers are aligned, even if we wrap, the vectorized loads/stores don't cross the final page boundary, and so it is not actually a problem).


http://reviews.llvm.org/D17268





More information about the llvm-commits mailing list