diff options
author | Richard Biener <rguenther@suse.de> | 2017-10-06 09:27:09 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2017-10-06 09:27:09 +0000 |
commit | d20eac1b41b9a86128a80f374e029d9638d14cba (patch) | |
tree | 049b9f13d10c464947754cf3b63b31f315f8dcc4 | |
parent | ac95a65da150a120cf729d1a773af7417e263330 (diff) | |
download | gcc-d20eac1b41b9a86128a80f374e029d9638d14cba.zip gcc-d20eac1b41b9a86128a80f374e029d9638d14cba.tar.gz gcc-d20eac1b41b9a86128a80f374e029d9638d14cba.tar.bz2 |
re PR tree-optimization/82397 (qsort comparator non-negative on sorted output: 1 in vect_analyze_data_ref_accesses)
2017-10-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/82397
* tree-vect-data-refs.c (dr_group_sort_cmp): Do not use
operand_equal_p but rely on data_ref_compare_tree for detecting
equalities.
(vect_analyze_data_ref_accesses): Use data_ref_compare_tree
to match up with dr_group_sort_cmp.
* gfortran.dg/pr82397.f: New testcase.
From-SVN: r253482
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr82397.f | 32 | ||||
-rw-r--r-- | gcc/tree-vect-data-refs.c | 49 |
4 files changed, 64 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8247946..a566686 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-10-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/82397 + * tree-vect-data-refs.c (dr_group_sort_cmp): Do not use + operand_equal_p but rely on data_ref_compare_tree for detecting + equalities. + (vect_analyze_data_ref_accesses): Use data_ref_compare_tree + to match up with dr_group_sort_cmp. + 2017-10-06 Andreas Krebbel <krebbel@linux.vnet.ibm.com> PR target/82322 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c7cbfa9..cf7f2c8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-06 Richard Biener <rguenther@suse.de> + + PR tree-optimization/82397 + * gfortran.dg/pr82397.f: New testcase. + 2017-10-06 Andreas Krebbel <krebbel@linux.vnet.ibm.com> PR target/82322 diff --git a/gcc/testsuite/gfortran.dg/pr82397.f b/gcc/testsuite/gfortran.dg/pr82397.f new file mode 100644 index 0000000..9a51e9e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr82397.f @@ -0,0 +1,32 @@ +! { dg-do compile } +! { dg-options "-Ofast" } + + subroutine foo(U,V,R,N,A) + integer N + real*8 U(N,N,N),V(N,N,N),R(N,N,N),A(0:3) + integer I3, I2, I1 +C + do I3=2,N-1 + do I2=2,N-1 + do I1=2,N-1 + R(I1,I2,I3)=V(I1,I2,I3) + * -A(0)*( U(I1, I2, I3 ) ) + * -A(1)*( U(I1-1,I2, I3 ) + U(I1+1,I2, I3 ) + * + U(I1, I2-1,I3 ) + U(I1, I2+1,I3 ) + * + U(I1, I2, I3-1) + U(I1, I2, I3+1) ) + * -A(2)*( U(I1-1,I2-1,I3 ) + U(I1+1,I2-1,I3 ) + * + U(I1-1,I2+1,I3 ) + U(I1+1,I2+1,I3 ) + * + U(I1, I2-1,I3-1) + U(I1, I2+1,I3-1) + * + U(I1, I2-1,I3+1) + U(I1, I2+1,I3+1) + * + U(I1-1,I2, I3-1) + U(I1-1,I2, I3+1) + * + U(I1+1,I2, I3-1) + U(I1+1,I2, I3+1) ) + * -A(3)*( U(I1-1,I2-1,I3-1) + U(I1+1,I2-1,I3-1) + * + U(I1-1,I2+1,I3-1) + U(I1+1,I2+1,I3-1) + * + U(I1-1,I2-1,I3+1) + U(I1+1,I2-1,I3+1) + * + U(I1-1,I2+1,I3+1) + U(I1+1,I2+1,I3+1) ) + enddo + enddo + enddo + return + end + diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index c4314a0..ca86498 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2727,43 +2727,30 @@ dr_group_sort_cmp (const void *dra_, const void *drb_) return loopa->num < loopb->num ? -1 : 1; /* Ordering of DRs according to base. */ - if (!operand_equal_p (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb), 0)) - { - cmp = data_ref_compare_tree (DR_BASE_ADDRESS (dra), - DR_BASE_ADDRESS (drb)); - if (cmp != 0) - return cmp; - } + cmp = data_ref_compare_tree (DR_BASE_ADDRESS (dra), + DR_BASE_ADDRESS (drb)); + if (cmp != 0) + return cmp; /* And according to DR_OFFSET. */ - if (!dr_equal_offsets_p (dra, drb)) - { - cmp = data_ref_compare_tree (DR_OFFSET (dra), DR_OFFSET (drb)); - if (cmp != 0) - return cmp; - } + cmp = data_ref_compare_tree (DR_OFFSET (dra), DR_OFFSET (drb)); + if (cmp != 0) + return cmp; /* Put reads before writes. */ if (DR_IS_READ (dra) != DR_IS_READ (drb)) return DR_IS_READ (dra) ? -1 : 1; /* Then sort after access size. */ - if (!operand_equal_p (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dra))), - TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb))), 0)) - { - cmp = data_ref_compare_tree (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dra))), - TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb)))); - if (cmp != 0) - return cmp; - } + cmp = data_ref_compare_tree (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dra))), + TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb)))); + if (cmp != 0) + return cmp; /* And after step. */ - if (!operand_equal_p (DR_STEP (dra), DR_STEP (drb), 0)) - { - cmp = data_ref_compare_tree (DR_STEP (dra), DR_STEP (drb)); - if (cmp != 0) - return cmp; - } + cmp = data_ref_compare_tree (DR_STEP (dra), DR_STEP (drb)); + if (cmp != 0) + return cmp; /* Then sort after DR_INIT. In case of identical DRs sort after stmt UID. */ cmp = tree_int_cst_compare (DR_INIT (dra), DR_INIT (drb)); @@ -2835,9 +2822,9 @@ vect_analyze_data_ref_accesses (vec_info *vinfo) and they are both either store or load (not load and store, not masked loads or stores). */ if (DR_IS_READ (dra) != DR_IS_READ (drb) - || !operand_equal_p (DR_BASE_ADDRESS (dra), - DR_BASE_ADDRESS (drb), 0) - || !dr_equal_offsets_p (dra, drb) + || data_ref_compare_tree (DR_BASE_ADDRESS (dra), + DR_BASE_ADDRESS (drb)) != 0 + || data_ref_compare_tree (DR_OFFSET (dra), DR_OFFSET (drb)) != 0 || !gimple_assign_single_p (DR_STMT (dra)) || !gimple_assign_single_p (DR_STMT (drb))) break; @@ -2851,7 +2838,7 @@ vect_analyze_data_ref_accesses (vec_info *vinfo) break; /* Check that the data-refs have the same step. */ - if (!operand_equal_p (DR_STEP (dra), DR_STEP (drb), 0)) + if (data_ref_compare_tree (DR_STEP (dra), DR_STEP (drb)) != 0) break; /* Do not place the same access in the interleaving chain twice. */ |