https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19347
Phosit <phosit at autistici dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phosit at autistici dot org --- Comment #9 from Phosit <phosit at autistici dot org> --- When there are few iterations (likely when it is unroled) there is no alias-check: void fill(int* data, int& value) { for(unsigned long i{0}; i != 4; ++i) data[i] = value; } --- at -O2 results in: fill(int*, int&): movd xmm1, DWORD PTR [rsi] pshufd xmm0, xmm1, 0xe0 movq QWORD PTR [rdi], xmm0 movd xmm0, DWORD PTR [rsi] pshufd xmm0, xmm0, 0xe0 movq QWORD PTR [rdi+8], xmm0 ret --- At -O3 the loop isn't removed and (thus) there is an alias-check.