Bug 58927 - Despite loop->safelen=INT_MAX / GCC ivdep: loop versioned for vectorization because of possible aliasing
Summary: Despite loop->safelen=INT_MAX / GCC ivdep: loop versioned for vectorization b...
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2013-10-30 18:58 UTC by Tobias Burnus
Modified: 2013-10-30 18:58 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2013-10-30 18:58:10 UTC
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);
}