Diagnostic 15019: loop was not vectorized: subscript too complex

Submit New Article

November 16, 2008 8:00 PM PST


Cause:

An array subscript may be too complicated for the compiler to decipher the memory access pattern.


typedef int TTT[64];
TTT *a[4];

int foo(void) {
  TTT *ref;
  int x=0,y=0;
  
  for (int k = 0; k < 64; k++) {
    ref = a[k];
    x += (*ref)[0];
  }
  return x;
}

>icl -c -Qvec-report2 t.cpp

Intel(R) C++ Compiler for applications running on Intel(R) 64, Version 12.0.0.063 Build 20100721
Copyright (C) 1985-2010 Intel Corporation.  All rights reserved.

t.cpp
t.cpp(10) (col. 12): remark: loop was not vectorized: subscript too complex.


Resolution:

Try to write the subscripts as an explicit function of the main loop counter:


typedef int TTT[64];
TTT *a[4];

int foo(void) {
  TTT *ref;
  int x=0,y=0;
    
  ref = a[0];  
  for (int k = 0; k < 64; k++) {
    x += (*ref)[k];
  }
  return x;
}

>icl -c -Qvec-report2 t2.cpp

Intel(R) C++ Compiler for applications running on Intel(R) 64, Version 12.0.0.063 Build 20100721
Copyright (C) 1985-2010 Intel Corporation.  All rights reserved.

t2.cpp
t2.cpp(9) (col. 3): remark: LOOP WAS VECTORIZED.





Do you need more help?

Thank you for your interest in this diagnostic message. We are still in the process of documenting this specific diagnostic.



Please let us know of your experience with this diagnostic message by posting a comment below. This will help us prioritize the order in which we document the diagnostics.




This article applies to: Intel® C++ Compiler for Linux* Knowledge Base,   Intel® C++ Compiler for Mac OS X* Knowledge Base,   Intel® C++ Compiler for Windows* Knowledge Base,   Intel® Parallel Composer Knowledge Base