UNROLL

The UNROLL option controls loop unrolling under optimization. Loop unrolling is an optimization that replicates a loop body multiple times and adjusts the loop control code accordingly.

Read syntax diagramSkip visual syntax diagram
              .-AUTO-.      
>>-UNROLL--(--+-NO---+--)--------------------------------------><

AUTO
Indicates that the compiler is permitted to unroll loops that it determines are appropriate for unrolling.

Specifying the UNROLL option can increase the size of the object code that is generated.

NO
Indicates that the compiler is not permitted to unroll loops.

The UNROLL option is ignored when the NOOPTIMIZE option is in effect.

Loop unrolling improves the performance of a program by exposing instruction level parallelism for instruction scheduling and software pipelining. It also creases code in the new loop body, which might increase pressure on register allocation, cause register spilling, and thus cause a loss in performance.

Therefore, before you unroll a loop, take the following steps to check if the UNROLL option improves the performance of a particular application:
  1. Compile the program with the usual options.
  2. Run the program with a representative workload.
  3. Recompile the program with the UNROLL option.
  4. Rerun the program under the same conditions.

UNROLL(AUTO) is the default.