Smoothing is when you have two different references to the same base memory. Consider this example:
int doit(int *n1, int *n2) { int x = 0; if (*n1 == 1) { *n2 = 0; x += *n1 // line of interest } return x; } int main() { int x = 1; doit(&x, &x); // aliasing happening }
If the compiler should allow anti-aliasing, it should take into account the possibility of n1 == n2 . Therefore, when he needs to use the value *n1 in the line "interest", he needs to allow the possibility of changing it on the line *n2 = 0 .
If the compiler cannot use aliases, it can accept in the "line of interest" that *n1 == 1 (because otherwise we would not be inside the if ). Then the optimizer can use this information to optimize the code (in this case, change the "line of interest" from the following pointer and make a general-purpose addition to use a simple increment).
R Samuel Klatchko
source share