[PATCH] D20789: Consecutive memory access in Loop Vectorizer - fixed and simplified

Ayal Zaks via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 5 16:56:41 PDT 2016


Ayal added a comment.

(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.


Repository:
  rL LLVM

http://reviews.llvm.org/D20789





More information about the llvm-commits mailing list