<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115595>115595</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Unable to vectorize loop with connectivity table on result index
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bemichel
</td>
</tr>
</table>
<pre>
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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVU1z4ygQ_TX40hWXBJIjHXSI7fLuHOY2e04haFlsEHgB2db8-i2Q5diz2apRqZQAr7sf_fHMvVdHg9iQckvK_YqPobeuaXFQoke9aq2cmj8VoTuS7Un2Nn-_QXATBAudMhJUB6FHh6A8cO2Qywm4AeX9iGBNPAQ_tn-jCITuoB0DfAOpJBgbZg_cTOtn_xfrPqKttvYEWn0ghF55ILTqQzh5wt4IPRB6OFrZWh3W1h0JPfwk9NCJXhZYFkhoHcNdErXIoVOGa1BG4nWh5dCPOgB3jk9ANtlENlm8xlGd0UA7JZAyAY_oIPBWY0R1XOC7QK0jGgh7g0fyZJPNryB0G9-0e7ZKgrDDaQz4rq3g-h2vweHACa1mCICwxoc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