The form i++ is called post-increment, meaning that the increment is done 'after' the variable use.
In your case the 'use' of the variable is to return its value, only after that the variable could be incremented. But because is a no sense to change something in an already terminated function the compiler optimizer simply doesn't increment the variable (the optimizer is *not* intended as code optimization level, but the standard code finalizer of the compiler: you could change this behaviour).