summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/vect/pr52580.f33
-rw-r--r--gcc/tree-data-ref.c50
4 files changed, 71 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fcd2c2e1202..31ab14bab86 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-15 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/52580
+ * tree-data-ref.c (subscript_dependence_tester_1): Check
+ all dimensions for non-conflicting access functions.
+
2012-03-15 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/44783
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9d57d21fcd7..d39995fb44b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-15 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/52580
+ * gfortran.dg/vect/pr52580.f: New testcase.
+
2012-03-15 Oleg Endo <olegendo@gcc.gnu.org>
* gcc.target/sh/fpul-usage-1.c: New.
diff --git a/gcc/testsuite/gfortran.dg/vect/pr52580.f b/gcc/testsuite/gfortran.dg/vect/pr52580.f
new file mode 100644
index 00000000000..eab9fa54bf5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr52580.f
@@ -0,0 +1,33 @@
+! { dg-do compile }
+! { dg-require-effective-target vect_double }
+ SUBROUTINE CALC2
+ IMPLICIT REAL*8 (A-H, O-Z)
+ PARAMETER (N1=1335, N2=1335)
+
+ COMMON U(N1,N2), V(N1,N2), P(N1,N2),
+ * UNEW(N1,N2), VNEW(N1,N2),
+ 1 PNEW(N1,N2), UOLD(N1,N2),
+ * VOLD(N1,N2), POLD(N1,N2),
+ 2 CU(N1,N2), CV(N1,N2),
+ * Z(N1,N2), H(N1,N2), PSI(N1,N2)
+ COMMON /CONS/ DT,TDT,DX,DY,A,ALPHA,ITMAX,MPRINT,M,N,MP1,
+ 1 NP1,EL,PI,TPI,DI,DJ,PCF
+ TDTS8 = TDT/8.D0
+ TDTSDX = TDT/DX
+ TDTSDY = TDT/DY
+
+ DO 200 J=1,N
+ DO 200 I=1,M
+ UNEW(I+1,J) = UOLD(I+1,J)+
+ 1 TDTS8*(Z(I+1,J+1)+Z(I+1,J))*(CV(I+1,J+1)+CV(I,J+1)+CV(I,J)
+ 2 +CV(I+1,J))-TDTSDX*(H(I+1,J)-H(I,J))
+ VNEW(I,J+1) = VOLD(I,J+1)-TDTS8*(Z(I+1,J+1)+Z(I,J+1))
+ 1 *(CU(I+1,J+1)+CU(I,J+1)+CU(I,J)+CU(I+1,J))
+ 2 -TDTSDY*(H(I,J+1)-H(I,J))
+ PNEW(I,J) = POLD(I,J)-TDTSDX*(CU(I+1,J)-CU(I,J))
+ 1 -TDTSDY*(CV(I,J+1)-CV(I,J))
+ 200 CONTINUE
+ RETURN
+ END
+! { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 1 "vect" } }
+! { dg-final { cleanup-tree-dump "vect" } }
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index e7bb16fcbc2..9b3a10df3c7 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -3460,6 +3460,7 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr,
unsigned int i;
tree last_conflicts;
struct subscript *subscript;
+ tree res = NULL_TREE;
for (i = 0; VEC_iterate (subscript_p, DDR_SUBSCRIPTS (ddr), i, subscript);
i++)
@@ -3471,40 +3472,43 @@ subscript_dependence_tester_1 (struct data_dependence_relation *ddr,
&overlaps_a, &overlaps_b,
&last_conflicts, loop_nest);
+ if (SUB_CONFLICTS_IN_A (subscript))
+ free_conflict_function (SUB_CONFLICTS_IN_A (subscript));
+ if (SUB_CONFLICTS_IN_B (subscript))
+ free_conflict_function (SUB_CONFLICTS_IN_B (subscript));
+
+ SUB_CONFLICTS_IN_A (subscript) = overlaps_a;
+ SUB_CONFLICTS_IN_B (subscript) = overlaps_b;
+ SUB_LAST_CONFLICT (subscript) = last_conflicts;
+
+ /* If there is any undetermined conflict function we have to
+ give a conservative answer in case we cannot prove that
+ no dependence exists when analyzing another subscript. */
if (CF_NOT_KNOWN_P (overlaps_a)
|| CF_NOT_KNOWN_P (overlaps_b))
{
- finalize_ddr_dependent (ddr, chrec_dont_know);
- dependence_stats.num_dependence_undetermined++;
- free_conflict_function (overlaps_a);
- free_conflict_function (overlaps_b);
- return false;
+ res = chrec_dont_know;
+ continue;
}
+ /* When there is a subscript with no dependence we can stop. */
else if (CF_NO_DEPENDENCE_P (overlaps_a)
|| CF_NO_DEPENDENCE_P (overlaps_b))
{
- finalize_ddr_dependent (ddr, chrec_known);
- dependence_stats.num_dependence_independent++;
- free_conflict_function (overlaps_a);
- free_conflict_function (overlaps_b);
- return false;
- }
-
- else
- {
- if (SUB_CONFLICTS_IN_A (subscript))
- free_conflict_function (SUB_CONFLICTS_IN_A (subscript));
- if (SUB_CONFLICTS_IN_B (subscript))
- free_conflict_function (SUB_CONFLICTS_IN_B (subscript));
-
- SUB_CONFLICTS_IN_A (subscript) = overlaps_a;
- SUB_CONFLICTS_IN_B (subscript) = overlaps_b;
- SUB_LAST_CONFLICT (subscript) = last_conflicts;
+ res = chrec_known;
+ break;
}
}
- return true;
+ if (res == NULL_TREE)
+ return true;
+
+ if (res == chrec_known)
+ dependence_stats.num_dependence_independent++;
+ else
+ dependence_stats.num_dependence_undetermined++;
+ finalize_ddr_dependent (ddr, res);
+ return false;
}
/* Computes the conflicting iterations in LOOP_NEST, and initialize DDR. */