Diagnostic 15011: loop was not vectorized: statement cannot be vectorized

Cause:

Usage of _Cilk_for or any other threading solution like OpenMP parallel for inside a SIMD loop is not allowed. When such a code construct is enocuntered, the compiler vetorizer emits "statement cannot be vectorized". Below is an examples for this scenario. 


Example:
 

extern int *a;
extern int **b;
 
int bar (int val);
int foo (int val)
{
  int i;
  _Cilk_for(i = 0; i < val; i++)  {
       b[i][val] += i;
    }
  return val;
}
 
void vevmsg_testcore005()
{   int i;
#pragma omp simd safelen(32)
  for(i = 0; i < 1024; i++) {
      a[i] = foo (i);
  }
}


>icpc -c -vec-report2 example5.cc -openmp 

example5.c(18): (col. 14) remark: loop was not vectorized: statement cannot be vectorized
example5.c(17): (col. 7) warning #13379: loop was not vectorized with "simd"
example5.c(8): (col. 35) remark: loop was not vectorized: vectorization possible but seems inefficient

Recommendation:


Follow a methodology where inner loops are vectorized and outer loops are threaded.

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