The compiler does local and global common subexpression elimination, e.g.:
i = x + y + 1;will be translated to
j = x + y;
iTemp = x + y;Some subexpressions are not as obvious as the above example, e.g.:
i = iTemp + 1;
j = iTemp;
a->b[i].c = 10;In this case the address arithmetic a->b[i] will be computed only once; the equivalent code in C would be.
a->b[i].d = 11;
iTemp = a->b[i];The compiler will try to keep these temporary variables in registers.
iTemp.c = 10;
iTemp.d = 11;