[PATCH] D20789: Consecutive memory access in Loop Vectorizer - fixed and simplified
Hal Finkel via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 5 18:53:12 PDT 2016
hfinkel added a comment.
In http://reviews.llvm.org/D20789#449385, @Ayal wrote:
> (1) Indeed *p++ should be treated just as consecutively as p[i++] by all means.
>
> (2) Could we simply use getPtrStride(), like so:
>
> int Stride = getPtrStride(PSE, Ptr, TheLoop, Strides);
> if (Stride == 1 || Stride == -1)
> return Stride;
> return 0;
>
> making it work with specialization for unit-stride (vectorizing the load in version-mem-access.ll)?
>
> (3) If you test for
>
> *to++ == *from--
>
> you'll also catch reverse consecutive, and won't compete with -loop-idiom's folding to memcpy; albeit cost will be higher.
You can also do `*to++ = 1 + *from++;` which will avoid the memcpy idiom issue.
Repository:
rL LLVM
http://reviews.llvm.org/D20789
More information about the llvm-commits
mailing list