8.2.6 Invariant-IF Restructuring

KAP recognizes loops with invariant-IFs. To avoid repeatedly performing the same IF test, KAP generates two versions of the loop and places the IF test outside. This transformation is enabled only when /scalaropt>2 . See the command qualifiers /each_invariant_if_growth and /max_invariant_if_growth for ways to restrict this transformation.

DO 1 I=1,N
IF (ADD) THEN
X(I) = X(I) + Y(I)
ELSE
X(I) = X(I) - Y(I)
ENDIF
1  CONTINUE
10 CONTINUE

Becomes:

IF (ADD) THEN
DO 3 I=1,N
X(I) = X(I) + Y(I)
3   CONTINUE
ELSE
DO 4 I=1,N
X(I) = X(I) - Y(I)
4    CONTINUE
ENDIF


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