This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49760] vectorization inhibited if indices are references
- From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 18 Jul 2011 09:39:51 +0000
- Subject: [Bug tree-optimization/49760] vectorization inhibited if indices are references
- Auto-submitted: auto-generated
- References: <bug-49760-4@http.gcc.gnu.org/bugzilla/>
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