[cfe-users] clang/llvm fails to vectorize a simple fill loop

Matthew Fernandez via cfe-users cfe-users at lists.llvm.org
Mon Feb 4 20:03:28 PST 2019


> On Feb 4, 2019, at 04:47, via cfe-users <cfe-users at lists.llvm.org> wrote:
> 
> Hi @all,
> 
> can anyone tell me, what is wrong with the following loop in Fill:
> 
> https://godbolt.org/z/hyZ2HO
> 
> Vectorization works for float, double and std::complex<float>, but it fails for std::complex<double>.
> The remark "read with atomic ordering or volatile read" hints for something, but neither do I know 
> exactly what, nor do I know how I can resolve the issue.

Just a guess, but sizeof(std::complex<double>) == 16 on x86-64, so maybe something in the vectorization analysis decides (a) you can’t read a 16-byte value atomically with a SIMD instruction and (b) the source and destination may alias each other. This is sort of nonsensical because (b) is false and (a) shouldn’t factor into this decision. Maybe someone with more knowledge of the vectorizer can chime in.


More information about the cfe-users mailing list