<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/114856>114856</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
vectorization regression in Clang 19
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
eyelash
</td>
</tr>
</table>
<pre>
When compiling the following code on x86-64 with `-O2`
```cpp
void foo(float* result, int size, float y, float delta) {
for (int t = 0; t < size; ++t) {
result[t] = y + delta * t;
}
}
```
It generates a lot of code that seems suboptimal. After [asking on Stack Overflow](https://stackoverflow.com/q/79156564/799849) I was told that this is a regression in Clang 19 that I should report here. The comments and [this answer](https://stackoverflow.com/a/79156703/799849) on Stack Overflow shed more light into what's going on here.
[Here's a link to this example on Compiler Explorer with Clang trunk](https://godbolt.org/z/7Y67cKTfx) that shows the suboptimal assembly.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE1zpDYQ_TXi0uUpIb4PHIwnU3HlsIdsVSpHDfQgxYImUuPx-NenBOM4m93DUhQ00P30XvdDOgQ7zoitKDpRHBO9siHf4g2dDiY503Br_zA4Q0_TYp2dR2CDcCHn6BqfehoQaIa3unwoc7haNiBK-fBFiVIKeRTy8X4t5X72y7K_eSU7wIVIqPriSLNQj-AxrI6FegI7MwT7jjHePsPtMxzQsRaqAVF1OxgAwIU8CFXHSgaRHUGKrNvCpx0q60CoTqiOv6uNx33xomNRHDeAW8zfV4NIj0X2USOq413Yv8GHwv_KfmYYcUavGQNocMRAl71rbDRDQJwChPVMC9tJuwM8Xhg9iKLT4SV2mGb4nXX_Al9e0V8cXUVxFKo2zEsQ2aNQJ6FOIWbQPeHQ0yTU6W-hTlWTFmVR5lvY1HkThT_DVQdgcsPOgY0NYCM9j6PHECzNYGd4cnoeIW32rGcIhlY3gMeFPINBjwf4ajB6Y8KZA-h5iMQ3PD2HK_qf5ao_uFYy-4brd-ohGBxgIo_g7Gg4GoXgaqJ_qgAj3Xu20fvGgEX3K3rcsjQ4O78A064d3_S0uM3HT5vP0cMvb4sjj3639N4K9uv88iNJIw1ncnwgPwp1eo8K_iyr_revl7coYp-0oWvY_p7PaYMOAaezux2Soc2GJmt0gm1aZbLK6zxLE9NWuWwwl5XGcmj6qk51lsq-VoUcyhSlSmyrpMrTVOZpo6o0Pciq0HlxrlRZ12mpB5FLnLR1B-dep0gxsSGs2KZpXhdl4vQZXdg2AKX6qFMoFfcC38aCh_M6BpFLZwOHTwi27LB9xZ7J23fN0TI_dk-yetf-r12WzXq-jz5C3m8Pi6e_sGehThvFINTpzvK1Vf8EAAD__3wYcw4">