Value Propagation

Visual Fortran tracks the values assigned to variables and constants, including those from DATA statements, and traces them to every place they are used. Visual Fortran uses the value itself when it is more efficient to do so.

When compiling subprograms, Visual Fortran analyzes the program to ensure that propagation is safe if the subroutine is called more than once.

Value propagation frequently leads to more value propagation. Visual Fortran can eliminate run-time operations, comparisons and branches, and whole statements.

In the following example, constants are propagated, eliminating multiple operations from run time:

Original Code Optimized Code
    PI = 3.14   
    .
    .
    .
    PIOVER2 = PI/2   
    .
    .
    .
    I = 100
    .
    .
    .
    IF (I.GT.1) GOTO 10    
10  A(I) = 3.0*Q

    .
    .
    .
    PIOVER2 = 1.57
    .
    .
    .
    I = 100
    .
    .
    .
	
10  A(100) = 3.0*Q