diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-01-23 09:35:38 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-01-23 09:35:38 +0100 |
commit | 37aa68563b3af16a1623490ae81f0712062f39e0 (patch) | |
tree | 93869e71f9b44de0864469f28a8179d033d501fd /gcc | |
parent | 4a75460b0099618b2d79ffda615a9516dcd5c224 (diff) | |
download | gcc-37aa68563b3af16a1623490ae81f0712062f39e0.zip gcc-37aa68563b3af16a1623490ae81f0712062f39e0.tar.gz gcc-37aa68563b3af16a1623490ae81f0712062f39e0.tar.bz2 |
re PR tree-optimization/88964 (ICE in wide_int_to_tree_1, at tree.c:1561)
PR tree-optimization/88964
* gimple-loop-interchange.cc (loop_cand::analyze_induction_var): Use
build_zero_cst instead of build_int_cst. Return false for loop
invariants which honor signed zeros.
* gfortran.dg/pr88964.f90: New test.
From-SVN: r268179
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/gimple-loop-interchange.cc | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr88964.f90 | 57 |
4 files changed, 75 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 015b36f..4a83a8a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-01-23 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/88964 + * gimple-loop-interchange.cc (loop_cand::analyze_induction_var): Use + build_zero_cst instead of build_int_cst. Return false for loop + invariants which honor signed zeros. + 2019-01-22 Segher Boessenkool <segher@kernel.crashing.org> * doc/invoke.texi (-fsplit-paths): This is enabled by default at -O3. diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc index bb01a9b..1f0e49d 100644 --- a/gcc/gimple-loop-interchange.cc +++ b/gcc/gimple-loop-interchange.cc @@ -688,11 +688,16 @@ loop_cand::analyze_induction_var (tree var, tree chrec) /* Var is loop invariant, though it's unlikely to happen. */ if (tree_does_not_contain_chrecs (chrec)) { + /* Punt on floating point invariants if honoring signed zeros, + representing that as + 0.0 would change the result if init + is -0.0. */ + if (HONOR_SIGNED_ZEROS (chrec)) + return false; struct induction *iv = XCNEW (struct induction); iv->var = var; iv->init_val = init; iv->init_expr = chrec; - iv->step = build_int_cst (TREE_TYPE (chrec), 0); + iv->step = build_zero_cst (TREE_TYPE (chrec)); m_inductions.safe_push (iv); return true; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3361da8..164c9bc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-23 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/88964 + * gfortran.dg/pr88964.f90: New test. + 2019-01-22 Martin Sebor <msebor@redhat.com> * c-c++-common/Warray-bounds-2.c: Include headers only if they exist. diff --git a/gcc/testsuite/gfortran.dg/pr88964.f90 b/gcc/testsuite/gfortran.dg/pr88964.f90 new file mode 100644 index 0000000..f3a8064 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr88964.f90 @@ -0,0 +1,57 @@ +! PR tree-optimization/88964 +! { dg-do compile } +! { dg-options "-O3 -fno-tree-forwprop --param sccvn-max-alias-queries-per-access=1" } + +MODULE pr88964 + INTEGER, PARAMETER :: dp=8 + REAL(KIND=dp) :: p, q, o +CONTAINS + SUBROUTINE foo(a,b,c,f,h) + IMPLICIT NONE + INTEGER :: a, b, c + REAL(KIND=dp) :: f(b*c), h(a*c) + CALL bar(h) + CALL baz(f) + CALL qux(h) + END SUBROUTINE foo + SUBROUTINE bar(h) + IMPLICIT NONE + REAL(KIND=dp) :: h(1*1) + INTEGER :: r, s, t, u + DO u = 1,3 + DO t = 1,1 + DO s = 1,3 + DO r = 1,1 + h((t-1)*1+r) = h((t-1)*1+r)-p*o + END DO + END DO + END DO + END DO + END SUBROUTINE bar + SUBROUTINE baz(f) + IMPLICIT NONE + REAL(KIND=dp) :: f(3*1) + INTEGER :: s, t, u + DO u = 1,4 + DO t = 1,1 + DO s = 1,3 + f((t-1)*3+s) = f((t-1)*3+s) - q + END DO + END DO + END DO + END SUBROUTINE baz + SUBROUTINE qux(h) + IMPLICIT NONE + REAL(KIND=dp) :: h(1*1) + INTEGER :: r, s, t, u + DO u = 1,5 + DO t = 1,1 + DO s = 1,3 + DO r = 1,1 + h((t-1)*1+r) = h((t-1)*1+r)-p*o + END DO + END DO + END DO + END DO + END SUBROUTINE qux +END MODULE pr88964 |