This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/84485] [6/7 Regression] Vectorising zero-stride rmw operation
- From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 12 Mar 2018 13:51:24 +0000
- Subject: [Bug tree-optimization/84485] [6/7 Regression] Vectorising zero-stride rmw operation
- Auto-submitted: auto-generated
- References: <bug-84485-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84485
--- Comment #3 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Author: rsandifo
Date: Mon Mar 12 13:50:52 2018
New Revision: 258450
URL: https://gcc.gnu.org/viewcvs?rev=258450&root=gcc&view=rev
Log:
Don't vectorise zero-step rmw operations (PR 84485)
GCC 6 and 7 would vectorise:
void
f (unsigned long incx, unsigned long incy,
float *restrict dx, float *restrict dy)
{
unsigned long ix = 0, iy = 0;
for (unsigned long i = 0; i < 512; ++i)
{
dy[iy] += dx[ix];
ix += incx;
iy += incy;
}
}
without first proving that incy is nonzero. This is a regression from
GCC 5. It was fixed on trunk in r256644, which versioned the loop based
on whether incy is zero, but that's obviously too invasive to backport.
This patch instead bails out for possibly-zero steps in the place that
trunk would try a check for zeroness.
Also, the patch makes vect_analyze_data_ref_access check safelen
as well as force_vectorize.
2018-03-12 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
PR tree-optimization/84485
* tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Return
true for zero dependence distances if the step might be zero,
and if there is no metadata that guarantees correctness.
(vect_analyze_data_ref_access): Check safelen as well as
force_vectorize.
gcc/testsuite/
PR tree-optimization/84485
* gcc.dg/vect/pr84485.c: New test.
Added:
branches/gcc-7-branch/gcc/testsuite/gcc.dg/vect/pr84485.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/tree-vect-data-refs.c