https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124902
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Even this should be vectorizable:
```
unsigned int foo(
const unsigned * __restrict__ a,
const unsigned * __restrict__ b,
const unsigned * __restrict__ c,
int n
) {
unsigned sum = 0;
for (int i = 0; i<n; i++)
{
if (a[i] != 0 || b[i] != 0)
{
sum += a[i];
sum += b[i];
}
}
return sum;
}
```
Note both GCC and LLVM does not vectorize the above case.
LLVM is able to handle this while GCC does not:
```
unsigned int foo(
const unsigned * __restrict__ a,
const unsigned * __restrict__ b,
const unsigned * __restrict__ c,
int n
) {
unsigned sum = 0;
for (int i = 0; i<n; i++)
{
int t = a[i] + b[i];
if (a[i] != 0 || b[i] != 0)
{
sum += t;
}
}
return sum;
}
```
I think is_cond_scalar_reduction is improved to handle this case then these all
would be vectorized.