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.
Comments should be complete sentences and end with a period.