General Compiler Directive: Assists the compiler's dependence analysis of iterative DO loops.
Syntax
cDEC$ IVDEP [: option]
c
Is one of the following: C (or c), !, or *. (See Syntax Rules for Compiler Directives.)
option
Is LOOP or BACK. This argument is only available on processors using IA-32 architecture.
Description
The IVDEP directive is an assertion to the compiler's optimizer about the order of memory references inside a DO loop.
IVDEP:LOOP implies no loop-carried dependencies. IVDEP:BACK implies no backward dependencies.
When no option is specified, the following occurs:
cDEC$ IVDEP with no option can also be spelled cDEC$ INIT_DEP_FWD (INITialize DEPendences ForWarD).
The IVDEP directive is applied to a DO loop in which the user knows that dependences are in lexical order. For example, if two memory references in the loop touch the same memory location and one of them modifies the memory location, then the first reference to touch the location has to be the one that appears earlier lexically in the program source code. This assumes that the right-hand side of an assignment statement is "earlier" than the left-hand side.
The IVDEP directive informs the compiler that the program would behave correctly if the statements were executed in certain orders other than the sequential execution order, such as executing the first statement or block to completion for all iterations, then the next statement or block for all iterations, and so forth. The optimizer can use this information, along with whatever else it can prove about the dependences, to choose other execution orders.
See Also
General Compiler Directives, Rules for General Directives that Affect DO Loops
Example
In the following example, the IVDEP directive provides more information about the dependences within the loop, which may enable loop transformations to occur:
!DEC$ IVDEP
DO I=1, N
A(INDARR(I)) = A(INDARR(I)) + B(I)
END DO
In this case, the scalar execution order follows:
IVDEP directs the compiler to initially assume that when steps 1 and 5 access a common memory location, step 1 always accesses the location first because step 1 occurs earlier in the execution sequence. This approach lets the compiler reorder instructions, as long as it chooses an instruction schedule that maintains the relative order of the array references.