2 ms·
Yeah, I read it the same as you: so alias checks can definitely happen even for single values. It seems like it's not just the loop counts that's the problem:
by BeeOnRope 7y ago
Yeah, I read it the same as you: so alias checks can definitely happen even for single values.
It seems like it's not just the loop counts that's the problem: in the blog post even when size is a local, it fails to check to see if the vector array pointer itself can alias.
I.e., analogous to incB here:
https://godbolt.org/z/ptQZcs https://godbolt.org/z/ptQZcs
incA is like your example: the possibly aliasing is between the array and the value added, and an alias check occurs. incB is like the v[i] example: possible aliasing is between the array and the pointer to the same array, no check and conservative code is generated.
Interesting...