Induction variables are variables, INTEGER or REAL, that are
incremented or decremented the same amount for each DO loop trip.
The -roundoff=3
switch is required for REAL induction
variable transformation.
The following loop has two induction variables, J
and K
. Transforming them into functions of the loop
index removes dependencies between iterations and can simplify other
optimizations, as shown in the following example:
DO 10 I = 1,200 A(J) = B(K) J = J + 1 K = K - 2 C(J) = D(I) 10 CONTINUE
Becomes:
II2 = K II1 = J DO 2 I=1,200 A(II1+I-1) = B(II2+I*(-2)+2) C(II1+I) = D(I) 2 CONTINUE J = II1 + 200 K = II2 - 400