Product Version: Intel(R) Visual Fortran Compiler XE 15.0 or a later version
The vectorization report generated when using Visual Fortran Compiler's optimization options ( /O2 /Qopt-report:2 /Qopt-report-phase:vec ) states that loop was not vectorized since loop with function call cannot be vectorized.
An example below will generate the following remark in optimization report:
subroutine bar(a) implicit none include 'omp_lib.h' integer (kind=omp_lock_kind) a call omp_init_lock(a) end subroutine bar subroutine foo(a,n) include 'omp_lib.h' integer (kind=omp_lock_kind) a(n) do i=1,n call bar (a(i)) end do end subroutine foo
ifort -c /O2 /Qopt-report:2 /Qopt-report-phase:vec /Qopt-report-file:stdout f15527.f90
Report from: Vector optimizations [vec]
LOOP BEGIN at f15527.f90(14,8)
f15527.f90(6,10):remark #15527: simd loop was not vectorized: function call to omp_init_lock cannot be vectorized
In order for the loop to be vectorized there should be no special operators and no function or subroutine calls, unless these are inlined, either manually or automatically by the compiler, or they are SIMD (vectorized) functions.