[Bug tree-optimization/56933] New: [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses
wschmidt at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Apr 12 12:40:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56933
Bug #: 56933
Summary: [4.9 Regression] Vectorizer missing read-write
dependency for interleaved accesses
Classification: Unclassified
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: wschmidt@gcc.gnu.org
CC: bergner@gcc.gnu.org, dje@gcc.gnu.org,
rguenth@gcc.gnu.org
Host: powerpc*-*-*
Target: powerpc*-*-*
Build: powerpc*-*-*
Created attachment 29861
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29861
Vectorization details dump for the test case
vect_analyze_group_access() in tree-vect-data-refs.c contains a test for
load-store dependencies:
if (GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (next))
|| GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (prev)))
Currently this always returns false because this field has not yet been set in
the vinfo. This began with r196872, where the code to analyze accesses was
moved ahead of the code to analyze dependences.
I put together a test demonstrating that it's possible for us to generate
incorrect code as a result:
subroutine test(a,b,c,d,e,f)
integer k
real*4, intent(out) :: a(1000)
real*4, intent(out) :: b(1000)
real*4, intent(in) :: c(1000)
real*4, intent(inout) :: d(2000)
real*4, intent(out) :: e(1000)
real*4, intent(out) :: f(1000)
do k = 1,1000
a(k) = 3.0 * d(2*k)
e(k) = 3.3 * d(2*k+1)
d(2*k) = 2.0 * c(k)
d(2*k+1) = 2.3 * c(k)
b(k) = d(2*k) - 5.5;
f(k) = d(2*k+1) + 5.5;
enddo
return
end
I'm attaching a detailed dump of the vectorization pass that shows that the
values of d(2*k) and d(2*k+1) used to compute b(k) and f(k) are the ones loaded
prior to the stores to those locations.
To reproduce on powerpc64-unknown-linux-gnu:
$ gfortran -O3 -ffast-math -mcpu=power7 -fno-vect-cost-model interl-lsl-2.f
More information about the Gcc-bugs
mailing list