https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111905
--- Comment #6 from Kamil Kaznowski <kamkaz at windowslive dot com> --- <source>:42:13: optimized: loop versioned for vectorization because of possible aliasing That's exactly the issue here! There should be no versioning here. There is no possible aliasing, and with -O2 it doesn't attempt to version the loop. That's the entire point of the function with __restrict arguments (as well as trying to suggest the optimization with assumes, which seem to be completely ignored in this case). There is a lot of extra code generated for trying to choose between the correct "version" based on the size of `w`. These paths are dead code.