I've been experimenting which optimizations gcc is willing to apply
depending on the kind of function arguments and compiler flags.
Perhaps someone can comment on what strange behavior I experienced:
If I understand the concept of C99's "restrict" qualifier for
function arguments correctly, it gives basically the same
"guarantees" to the compiler as -fargument-noalias-global.
However, gcc applies much more aggressive optimizations (for my test
kernels the new predictive commoning seems to be most benefical) for -
fargument-noalias, and seems to take no advantage of "restrict" in
C99 (or the __restrict__ extension, in C99 as well as in C++).
Quite strange, optimization seems to be at least as good for C99's
VLAs, even without restrict and without -fargument-noalias. I don't
have the C99 standard to read that up, but could not find a hint on
the web that VLA arguments are forbidden to alias.
Am I overlooking something here? Why is "restrict" not useful in that
context (but -fargument-noalias is)? And why does it work for VLAs
without any of both?
Regards,
Markus