5 questions to test your understanding
A compiler fails to vectorize a loop that reads from array a[] and writes to array b[]. The programmer is confident the arrays don't overlap and is frustrated the optimization was missed. What is the most likely reason the compiler didn't vectorize?
Alias analysis reports 'may-alias' for two pointer accesses that a compiler transformation would need to reorder. What does the compiler do?
Under C's strict aliasing rules, type-based alias analysis (TBAA) can determine that an int* and a float* is expected to alias each other, since they could point to the same memory.
Alias analysis must err on the side of reporting 'may-alias' rather than 'no-alias' when uncertain, because incorrectly claiming non-aliasing could change the program's observable behavior.
Why does alias analysis err on the side of 'may-alias' when uncertain, and what is the practical cost of this conservatism for optimization?