Diagnostic 15046: loop was not vectorized: existence of vector dependence


False dependency is assumed in the loop body by the compiler. The compiler to be on the safer side assumes that there could be a overlap between arrays a[] and b[] to avoid any data corruption. In this case, this assumption happens to be a false dependence. Below is an example for this scenario. 


#include <complex>
typedef std::complex<double> c;
void star( c* a, const c* b, size_t n,int sign ) {
   #pragma nounroll
   // #pragam omp simd // programmers can force vectorization using SIMD pragma. 
    for( size_t i=0; i<3; ++i )
        a[i] *= b[i]*(double(sign)/n);

>icl -c -Qvec-report2 example4.cpp
example4.cpp(7): (col. 5) remark: loop was not vectorized: existence of vector dependence


By introducing the #pragma omp simd, programmer explicitly vectorizes the loop since he is aware that there is no true vector dependency in the loop body.

For more complete information about compiler optimizations, see our Optimization Notice.

1 comment


Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.