http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59594
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- On: #define N 1024 int ia[N + 1]; int ib[N + 1]; void f1 (void) { int i; for (i = 0; i < N; i++) { ia[i + 1] = 1; ib[i] = ia[i]; } } void f2 (void) { int i; for (i = 0; i < N; i++) { ia[i] = 1; ib[i] = ia[i + 1]; } } void f3 (void) { int i; for (i = N - 1; i >= 0; i--) { ia[i + 1] = 1; ib[i] = ia[i]; } } void f4 (void) { int i; for (i = N - 1; i >= 0; i--) { ia[i] = 1; ib[i] = ia[i + 1]; } } we properly vectorize f2 and f3 where the write/read DDR is DDR_REVERSED_P and not f1/f4. On #define N 1024 int ia[N + 1]; int ib[N + 1]; void f1 (void) { int i; for (i = 0; i < N; i++) { ia[i + 1] = 1; ia[i] = 2; } } void f2 (void) { int i; for (i = 0; i < N; i++) { ia[i] = 1; ia[i + 1] = 2; } } void f3 (void) { int i; for (i = N - 1; i >= 0; i--) { ia[i + 1] = 1; ia[i] = 2; } } void f4 (void) { int i; for (i = N - 1; i >= 0; i--) { ia[i] = 1; ia[i + 1] = 2; } } we don't vectorize f1 and f2, in both cases for the write/write DDR DDR_REVERSED_P is false, and vectorize f3/f4, where DDR_REVERSED_P is true in both cases. f2 and f3 shouldn't be vectorizable (at least not as is, when we'd be trying to vectorize the two stores just by putting a vector store at that position), f1 and f4 can. So, this leads me to believe that for write/write we don't have a way to differentiate between the bad and good cases using dist > 0 && DDR_REVERSED_P test. In that case, I'd think best would be to not ignore dist > 0 && DDR_REVERSED_P (ddr) ddrs if (!DR_IS_READ (dra) && !DR_IS_READ (drb)).