Product Version: Intel(R) Visual Fortran Compiler XE 15.0.0.070
Cause:
The vectorization report generated when using Visual Fortran Compiler's optimization options ( -O3 or -O2 -Qopt-report:2 ) states that loop was not vectorized since loop contains GOTO statement.
Example:
An example below will generate the following remark in optimization report:
subroutine foo(a, b, n) implicit none integer, intent(in) :: n real,intent(inout) :: a(n) integer, intent(inout) :: b(n) integer:: i do i=1,n goto (100,200,300,400,100,200,300,400) b(i) 100 a(i) = a(i) + 1 if (a(i) .gt. 0) goto 400 200 a(i) = a(i) + 1 400 continue 300 a(i) = a(i) + 1 end do end subroutine foo
Report from: Loop nest, Vector & Auto-parallelization optimizations [loop, vec, par]
Non-optimizable loops:
LOOP BEGIN at f15534.f90(15,7)
remark #15534: loop was not vectorized: loop contains arithmetic if or computed goto. Consider using if-then-else statement.
LOOP END
Resolution:
Premature exits from loops prevent vectorization, rewriting the code without GOTO statements will get this loop vectorized.
See also:
Requirements for Vectorizable Loops
Vectorization and Optimization Reports