hi,
For test s1113( Compiler Explorer ), now both llvm and gcc can’t vectorize
void s1113(void)
{
for (int i = 0; i < LEN_1D; ++i) {
a[i] = a[LEN_1D/2] + b[i];
}
}
While its equivalent function source s1113_1, both llvm and gcc can vectorize
void s1113_1(void) {
const real_t c1 = a[LEN_1D/2];
const real_t c2 = b[LEN_1D/2];
for (int i = 0; i < LEN_1D; ++i) {
a[i] = c1 + b[i];
if (i > LEN_1D/2)
a[i] += c2;
}
}
so is there a suitable pass for such conversions?