http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49773
Summary: use of class data members prevent vectorization Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: vincenzo.innoce...@cern.ch in this example below the loop in the first method does not vectorize, the second does. struct Foo { float a; float b; void compute1(float * __restrict__ x, float const * __restrict__ y, int N) const; void compute2(float * __restrict__ x, float const * __restrict__ y, int N) const; }; void Foo::compute1(float * __restrict__ x, float const * __restrict__ y, int N) const { for (int i=0; i!=N; ++i) x[i] = a + b*y[i]; } void Foo::compute2(float * __restrict__ x, float const * __restrict__ y, int N) const { float la=a, lb=b; for (int i=0; i!=N; ++i) x[i] = la + lb*y[i]; } test/vectClass.cpp:11: note: not vectorized: loop contains function calls or data references that cannot be analyzed test/vectClass.cpp:10: note: vectorized 0 loops in function. vs test/vectClass.cpp:17: note: Profitability threshold is 5 loop iterations. test/vectClass.cpp:17: note: LOOP VECTORIZED. test/vectClass.cpp:15: note: vectorized 1 loops in function.