http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58927
Bug ID: 58927 Summary: Despite loop->safelen=INT_MAX / GCC ivdep: loop versioned for vectorization because of possible aliasing Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Compiling the testsuite's pr33426-ivdep-4.cc g++ -std=c++11 -O3 -fopt-info-vec-optimized g++.dg/vect/pr33426-ivdep-4.cc shows that the C++11 range-based loop has loop versioning, even though it shouldn't due to GCC ivdep: g++.dg/vect/pr33426-ivdep-4.cc:13:19: note: loop vectorized g++.dg/vect/pr33426-ivdep-4.cc:13:19: note: loop versioned for vectorization because of possible aliasing g++.dg/vect/pr33426-ivdep-4.cc:13:19: note: loop peeled for vectorization to enhance alignment The function is simply: #include <vector> template<class T, class T2> void Loop(T *b, T2 c) { #pragma GCC ivdep for (auto &i : *b) { i *= *c; } } void foo(std::vector<int> *ar, int *b) { Loop<std::vector<int>, int*>(ar, b); }