8.2.5 Lifetime Analysis

In general, when KAP inserts an iteration-local temporary, the last value assigned to that temporary must be reassigned to the original scalar. When /optimize is set to 2 or higher, KAP performs lifetime analysis to determine if the value of the original scalar is used outside the loop. When the command qualifier /save=a is in effect (the default), live variable analysis will be performed to identify scalar local variables in subroutines and functions that require that their values be retained invocations.

KAP determines if it is possible to reuse the result computed in the loop later in the program unit. If so, the variable is assigned the value it would have received in the serial loop, as shown in the following example:

DO 20 I=1,N
DO 20 J=1,N
X = A(I,J)
Y = B(I,J)
20  C(I,J) = X + Y
PRINT *, X

Becomes:

LL1 = N .GT. 0
DO 3 I=1,N
DO 2 J=1,N
C(I,J) = A(I,J) + B(I,J)
2   CONTINUE
IF (LL1) X = A(I,N)
3  CONTINUE
PRINT *, X

The roundoff=0 qualifier was used to disable memory management.


Previous Page | Next Page | Contents | Index |
Command-Line Qualifiers