[Bug tree-optimization/49760] vectorization inhibited if indices are references

vincenzo.innocente at cern dot ch gcc-bugzilla@gcc.gnu.org
Mon Jul 18 09:40:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49760

--- Comment #2 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2011-07-18 09:39:49 UTC ---
Thanks for the detailed explanation.
In the real life code, "out" is filled  calling "foo" multiple times (a sort of
nested loop), "k" was used to track the current size of it.
It is true that in this particular case  I can just  k+=N; at the end of the
loop.

The issue is more with 
"for (int i=0; i!=in.size; ++i)" as in foo2 
because of
"not vectorized: number of iterations cannot be computed"
while copying it locally in N works.


b.t.w.
void foo(SoA const & __restrict__ in, SoB & __restrict__ out, int &
__restrict__ k) {
  int N=in.size;
  for (int i=0; i!=N; ++i) {
    out.b[k] = in.c[i]+in.b[i];
    out.a[k] = in.a[i];
    ++k;
  }
}
does not vectorize either



More information about the Gcc-bugs mailing list