When a loop contains an IF statement whose condition does not change from one iteration to another, the same test must be repeated for every iteration. The code can often be made more efficient by floating the IF outside the loop and putting the THEN and ELSE sections into their own loops.
This gets more complicated when there is other code in the loop,
because a copy of it must be included in both the THEN and ELSE
loops. The /max_invariant_if_growth
qualifier allows
you to limit the total number of additional lines of code generated
in each program unit through invariant-IF restructuring.
The /miifg
setting is the maximum number of lines
to which a program unit may grow due to invariant-IF floating.
If restructuring a loop with invariant IFs would cause the size
of the program unit to exceed this limit, the restructuring will
not be performed. For example, if /miifg=500
and the
original size of a subroutine was 450 noncomment lines, then at most
50 additional lines may be added by invariant-IF floating. Since
other KAP transformations can add or delete lines, the number of
lines actually added by invariant-IF floating and the final size of
a program unit may differ from what the /miifg
value
alone would cause.
This can be controlled on a loop-by-loop basis with the
C*$* max_invariant_if_growth
(<integer>) directive. The
maximum amount of additional code generated in a single loop through
invariant-IF floating can be limited with the /each_invariant_
if_growth
qualifier.