-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
Description
Bugzilla Link | 27625 |
Version | 3.8 |
OS | Linux |
Reporter | LLVM Bugzilla Contributor |
CC | @hfinkel |
Extended Description
#define SIZE (1 << 15)
#define XMM_ALIGNMENT_BYTES 16
float *vec_a __attribute__((aligned (XMM_ALIGNMENT_BYTES)));
float *vec_b __attribute__((aligned (XMM_ALIGNMENT_BYTES)));
float *vec_c __attribute__((aligned (XMM_ALIGNMENT_BYTES)));
void matvec_autovec()
{
int i, j;
for (i = 0; i < SIZE; i++) {
for (j = 0; j < SIZE; j++) {
vec_c[i] += vec_a[j] * vec_b[j];
}
}
}
Command used: clang-3.8 -c -S -Ofast -Rpass-analysis=loop-vectorize test.c
test.c:17:22: remark: loop not vectorized: value that could not be identified as reduction is used outside the loop [-Rpass-analysis=loop-vectorize]
vec_c[i] += vec_a[j] * vec_b[j];```
I was expecting that vec_c[i]
to be treated as inner loop invariant and the vectorization would work. The auto-vectorization works fine if I use a tmp variable for accumulation. Could someone explain why the vectorizer bails out in this case?