This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/49760] New: 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: Sat, 16 Jul 2011 09:37:35 +0000
- Subject: [Bug tree-optimization/49760] New: vectorization inhibited if indices are references
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49760
Summary: vectorization inhibited if indices are references
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: vincenzo.innocente@cern.ch
in this simple example only the third function vectorize even if they look
semantically identical to me
c++ -Wall -ftree-vectorizer-verbose=7 -Ofast -c test/testSoA.cpp
gcc version 4.7.0 20110528 (experimental) (GCC)
struct SoA {
int * __restrict__ a;
float * __restrict__ b;
float * __restrict__ c;
int size;
};
struct SoB {
int * __restrict__ a;
float * __restrict__ b;
int size;
};
void foo(SoA const & in, SoB & out, int & k) {
int N=in.size;
for (int i=0; i!=N; ++i) {
out.b[k] = in.a[i]+in.b[i];
out.a[k] = in.a[i];
++k;
}
}
void foo2(SoA const & in, SoB & out, int & k) {
int j=k;
for (int i=0; i!=in.size; ++i) {
out.b[j] = in.a[i]+in.b[i];
out.a[j] = in.a[i];
++j;
}
k = j;
}
void foo3(SoA const & in, SoB & out, int & k) {
int j=k;
int N=in.size;
for (int i=0; i!=N; ++i) {
out.b[j] = in.a[i]+in.b[i];
out.a[j] = in.a[i];
++j;
}
k = j;
}
messages are
test/testSoA.cpp:17: note: not vectorized: loop contains function calls or data
references that cannot be analyzed
test/testSoA.cpp:15: note: vectorized 0 loops in function.
test/testSoA.cpp:26: note: not vectorized: number of iterations cannot be
computed.
test/testSoA.cpp:24: note: vectorized 0 loops in function.
test/testSoA.cpp:38: note: cost model: epilogue peel iters set to vf/2 because
loop iterations are unknown .
â..
test/testSoA.cpp:38: note: Profitability threshold is 5 loop iterations.
â.
test/testSoA.cpp:38: note: created 5 versioning for alias checks.
test/testSoA.cpp:38: note: LOOP VECTORIZED.
test/testSoA.cpp:35: note: vectorized 1 loops in function.
I will submit a different PR for the alias checks that looks not needed to me