Diagnostic 15414: Loop was not vectorized: loop body became empty after optimizations

Product Version:Intel® Fortran Compiler 15.0 and above

Cause:

The vectorization report generated when using Intel® Fortran Compiler's optimization options (/O2 /Qopt-report:2) states that loop was not vectorized since loop body became empty after optimizations.

Example:

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

integer function foo(a, b, n) 
    implicit none
    integer, intent(in) :: n
    real, intent(inout) :: a
    real, intent (in)   :: b
    integer :: i
    
    do i=1,n
           a = b + 1
    end do
    
    foo = a
    
end function 
ifort -c /O2 /Qopt-report:2 /Qopt-report-file:stdout f15414.f90
 
Report from: Interprocedural optimizations [ipo]
 
INLINING OPTION VALUES:
  -Qinline-factor: 100
  -Qinline-min-size: 30
  -Qinline-max-size: 230
  -Qinline-max-total-size: 2000
  -Qinline-max-per-routine: 10000
  -Qinline-max-per-compile: 500000
 
 
Begin optimization report for: FOO
 
    Report from: Interprocedural optimizations [ipo]
 
INLINE REPORT: (FOO) [1] f15414.f90(1,18)
 

Resolution:

In the example above, there is only one expression inside the loop. When moved outside the loop as a result of the compiler's optimization process there is nothing else left inside the loop to vectorize. 

See also:

Requirements for Vectorizable Loops

Vectorization Essentials

Vectorization and Optimization Reports

Back to the list of vectorization diagnostics for Intel Fortran

Para obter informações mais completas sobre otimizações do compilador, consulte nosso aviso de otimização.