I should add the proviso to the "for an incrementing counter, no, never". If it's just a loop where the counter variable is never used apart from the count, then it's possible to optimise it. If the variable is used at all (as in the case above), is global, etc, then it can't be optimised in that way.
Of course a compiler can do such optimizations, even when the loop variable itself is used, which most likely is the case.
The point is, that the compiler have to analize loop carried dependencies to verify if any affine transformation is valid. In order to do so, it has to determine all side effects. So with a function call within the loop you are out of luck, but it is very well possible if all side effects can be determined.
For instance if no variable from the right hand side appears on the left hand side of an assignement, the loop interations are considered fully permutable. Thus jaguards example is fully permutable, in particular any affine transformation will work.
A good example of a loop carried dependence is the loop:
for (i=0; i<X; i++) a[i]=a[i+1];
Obviously you have a dependence from iteration i->i+1 and the loop cannot be transformed.
Tala