The low level GIMPLE does no longer contain loop syntactic structures (see the loops_structure article). The number of iterations is determined thus from the [evolution functions||scalar evolution analyzer] of the variables that appear in the loop exit condition.
TODO:
When the number of iterations cannot be determined it is still possible to determine a safe approximation.
Example: In this case the number of iterations can be determined symbolically, however it is possible to give a more precise upper bound estimation by looking at the data size and at the access functions used in the loops: the scalar_evolution_analyzer can determine the following access functions:
{{0, +, 1}_1, +, 1335}_2 {0, +, 1336}_1
Now given the fact that the size of the array u is 1782225, and that an access outside of the allocated size invokes undefined behavior, it is possible to say that N 1335, (because {0, +, 1336} (1335) 1336 * 1335 = 1783560).