Re:Incrementing vectors
by BeeOnRope on Tuesday August 27, 2019 @04:14PM
(#20813988)
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.
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.
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
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...