<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55299>55299</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
vectorization failed on reverse copy of an array.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
abique
</td>
</tr>
</table>
<pre>
Hi,
clang-13.0.1 failed to vectorize the following code:
```C
#pragma clang loop vectorize(enable) interleave(enable)
for (int k = 0; k < N; ++k)
out[k] = in[N - k - 1];
```
With: `warning: loop not vectorized: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering`
I think this code is vectorizable, the compiler would need to load a vector, then reverse it using shuffle and then store it.
Eventually it will perform unaligned loads or store.
Regards,
Alex
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxlUzuTmzAQ_jXQ7JjBwuBQUNzZySTNFWlSC7SAYlkikrDj_PqshB_nO0YD-979Pi2tEZfmu0zYLsn3Sf6yvDvF9bBaF1meraHnUqEAb-CEnTdW_kPwI0JvlDJnqQfojMCkuOYmVb6cW0VWTJYPRw6xKihjpkelhH1BzVtFQg1Se7QK-enJvJSB29MbC-SmWDhAUuwhT4rXKO7gLYgJe6Vz-JxJj5l9UpKv3MdUqUl7gxWlr2BNVsr_gOI9Lb-kHwknkPnMrSboQYuAtPEPUCKYA0Vm8vJIBgtn7mCOiAKRE1qCcYwxFv_M6Hxg2HLtgp17aXSAEvzPVjjKYfTQIgjpQjkBxIebsJO9JIXaTNx6MD1wTR3dPE3Gfq5OWQJtQPAM8Qf1lPoQ3i7eK9D3Bmy5kF0cqzPHifaCkJlZCdC4rIgynIa4ZlxjNWE8oXVUy8Pswsa4ce574oJrsUQ4Cg_-bBnj6wm1n7lSl5BzlkrdOSMWlRw0tQu9XIQfkrP3MH7iwK1w97V-Ufg3FU0h6qLmqZdeYXNHFfm4brl5DNuZ6XLlkVvLL1k6W9WM3k8uLDv7RmegjZjbjMggRanT7bOarPlN9UmVztH9klCWrK7Tsemqsi1EXm77AotNz4p6w7Zt3ffbsiKXSBVvUbmGVjNhTOMZYgmSaUFT2bCcsbzMq3ybV2WdITL6WSoUHVu3VbtONjkeCUwW5siMHVLbxJHaeXDkVNJ593By5wKbGNtRfT770diGt5LWMo2dmzj5f8z2VxA">