Issue 115595
Summary Unable to vectorize loop with connectivity table on result index
Labels new issue
Assignees
Reporter bemichel
    Hi,

I try to find if there is already an issue on the subject, but I did not find any.

I work on loop like this (https://godbolt.org/z/fchd4e54e), where the final index on the result array `y` is given by the integer table `face_cell`  : 

```c++
void compute_local_extrema(
  const int                nface, 
  const int ncell, 
  const int*    __restrict face_cell,
  const double* __restrict x, 
        double* __restrict y) {
  int il, ir;

#pragma clang loop distribute(enable) vectorize(enable) interleave(enable)
  for (int iface=0; iface<nface; ++iface) {
    il = face_cell[iface];
    ir = face_cell[iface+nface];
    y[il] = std::max(y[il], x[ir]);
  }
}
```

It seems that the auto-vectorize does not work on the kind of loop, despite the fact that it seems working on GCC (https://godbolt.org/z/944q8M6T1 from 12.2 to 13.3).

Is there a way to finally vectorize this kind of loop ?
If it is possible, can you give me some advices on how to do this?

Thanks a lot for your help.

Bertrand M.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to