[PATCH] D19258: Loop vectorization with induction variable with non-constant step.

Elena Demikhovsky via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 04:10:00 PDT 2016


delena created this revision.
delena added reviewers: Ayal, anemet, hfinkel.
delena added a subscriber: llvm-commits.
delena set the repository for this revision to rL LLVM.
Herald added a subscriber: mzolotukhin.

One of vectorization limitation today is non-const step of induction variable.
In this patch, I allow vectorization when the step is a loop-invariant variable.
This is the loop example that was vectorized after my patch:
 int int_inc;
 int bar(int init, int *restrict A, int N) {
  int x = init;
   for (int i=0;i<N;i++){
     A[i] = x;
     x += int_inc;
   }
   return x;
}
In this case "x" is an induction variable with"init_inc" step. Loop exit count is calculated from another induction variable "i".
The following loop remains scalar right now:
  for (int i=0; i<N; i+=int_inc) {
    A[i] = i;
  }
In this case the vectorizer can't calculate the exit count.



Repository:
  rL LLVM

http://reviews.llvm.org/D19258

Files:
  ../include/llvm/Transforms/Utils/LoopUtils.h
  ../lib/Transforms/Utils/LoopUtils.cpp
  ../lib/Transforms/Vectorize/LoopVectorize.cpp
  ../test/Transforms/LoopVectorize/induction-step.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19258.54172.patch
Type: text/x-patch
Size: 8772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160419/316d604c/attachment.bin>


More information about the llvm-commits mailing list