The downward for loop is faster than the upward one. Because of that, when direction of the for loop variable doesn't affect the result, the compiler optimizes the code and generates the downward loop.