Diagnostic 15523: Loop was not vectorized: cannot compute loop iteration count before executing the loop.

By Devorah Hayman, Published: 10/29/2014, Last Updated: 10/29/2014

Product Version: Intel(R) Visual Fortran Compiler XE 15.0 or a later version

Cause:

The vectorization report generated when using Visual Fortran Compiler's optimization options ( /O3 /Qopt-report:2 /Qopt-report-phase:vec ) states that loop was not vectorized since loop iteration count cannot be computed before the loop is executed.

Example:

An example below will generate the following remark in optimization report:

subroutine foo(a, n)
    
       implicit none
       integer, intent(in) :: n
       double precision, intent(inout) :: a(n)
       integer :: bar
       integer :: i
       
       i=0
 100   CONTINUE
       a(i)=0
       i=i+1
       if (i .lt. bar()) goto 100
       
  end subroutine foo

ifort -c /O3 /Qopt-report:2 /Qopt-report-phase:vec /Qopt-report-file:stdout f15523.f90

Begin optimization report for: FOO

Report from: Vector optimizations [vec]

  LOOP BEGIN at f15523.f90(9,8)

  LOOP BEGIN  
      remark #15523: loop was not vectorized: loop control variable I was found, but loop iteration count cannot be computed before executing the loop.
 
  LOOP END

Resolution:

 -goto statements prevent vectorization. Rewriting the code using 'do - end do'' loops where iteration count is computed before execution of the loop will get this loop vectorized. 

See also:

Requirements for Vectorizable Loops

Vectorization Essentials

Vectorization and Optimization Reports

Back to the list of vectorization diagnostics for Intel® Fortran

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804