gcc 4.5 can not vectorize this simple loop: void foo(int a[], int n) { int i; for(i=1; i< n; i++) a[i] = a[0]; }
"gcc -O3 -fdump-tree-vect-all -c foo.c" shows: foo.c:3: note: not vectorized: unhandled data-ref foo.c:3: note: bad data references. foo.c:1: note: vectorized 0 loops in function. It seems gcc gets confused at a[0] and gives up vectorization. There is no dependence in this loop, and we should teach gcc to handle a[0] to vectorize it. -- Summary: gcc could not vectorize this simple loop (un-handled data-ref) Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: changpeng dot fang at amd dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43182