From 85004cb2dcc43010001d6231cf6aca6eb769d2c3 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 5 Sep 2018 10:33:41 +0000 Subject: [PATCH] re PR tree-optimization/87217 (ICE in in check_loop_closed_ssa_def, at tree-ssa-loop-manip.c:709 when compiling SPEC2000 starting with r264069) 2018-09-05 Richard Biener PR tree-optimization/87217 * tree-ssa-sccvn.c (vuse_valueize): New. (vn_reference_lookup_pieces): Use it. (vn_reference_lookup): Likewise. * gfortran.dg/pr87217.f: New testcase. From-SVN: r264121 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr87217.f | 32 +++++++++++++++++++++++++++++ gcc/tree-ssa-sccvn.c | 23 +++++++++++++++++++-- 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr87217.f diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 45b97c17386..47bc612b820 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-09-05 Richard Biener + + PR tree-optimization/87217 + * tree-ssa-sccvn.c (vuse_valueize): New. + (vn_reference_lookup_pieces): Use it. + (vn_reference_lookup): Likewise. + 2018-09-05 Nathan Sidwell PR c++/87137 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 386e3844ce9..12bb8a29d89 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-09-05 Richard Biener + + PR tree-optimization/87217 + * gfortran.dg/pr87217.f: New testcase. + 2018-09-05 Pádraig Brady p@draigbrady.com PR c++/87137 diff --git a/gcc/testsuite/gfortran.dg/pr87217.f b/gcc/testsuite/gfortran.dg/pr87217.f new file mode 100644 index 00000000000..163a276be29 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr87217.f @@ -0,0 +1,32 @@ +! { dg-do compile } +! { dg-options "-O3" } + implicit real*8 (a-h,o-z) + common clop6(3),dps(6),aml6(6,6) + dimension y1(3) + dimension dclo(3) + dimension dx(3),dy(3) + save + do 80 ii=1,itco + y1(3)=dps(1) + do 40 l=1,3 + dy(l)=clop6(l)-y1(l) + 40 continue + dczp=abs(dy(3)) + if(dcx.le.c1m10.and.dcz.le.c1m10.and.dcxp.le.c1m10.and.dczp + + .le.c1m10.and.dcy.le.c1m10.and.dcyp.le.c1m10) goto 90 + 80 continue + write(6) itco + ii=itco + 90 continue + if(ii.ne.itco) then + do 65 k=1,3 + do 55 j=1,3 + jj=2*j + kk=2*k + dclo(k)=aml6(kk-1,jj-1)*dx(j)+dclo(k) + dclo(k)=aml6(kk-1,jj)*dy(j)+dclo(k) + 55 continue + 65 continue + endif + end + diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 1e4bfe5f7ba..105605a45f8 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -493,6 +493,25 @@ vuse_ssa_val (tree x) return x; } +/* Similar to the above but used as callback for walk_non_aliases_vuses + and thus should stop at unvisited VUSE to not walk across region + boundaries. */ + +static tree +vuse_valueize (tree vuse) +{ + do + { + bool visited; + vuse = SSA_VAL (vuse, &visited); + if (!visited) + return NULL_TREE; + gcc_assert (vuse != VN_TOP); + } + while (SSA_NAME_IN_FREE_LIST (vuse)); + return vuse; +} + /* Return the vn_kind the expression computed by the stmt should be associated with. */ @@ -2573,7 +2592,7 @@ vn_reference_lookup_pieces (tree vuse, alias_set_type set, tree type, (vn_reference_t)walk_non_aliased_vuses (&r, vr1.vuse, vn_reference_lookup_2, vn_reference_lookup_3, - vuse_ssa_val, &vr1); + vuse_valueize, &vr1); gcc_checking_assert (vr1.operands == shared_lookup_references); } @@ -2629,7 +2648,7 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind, (vn_reference_t)walk_non_aliased_vuses (&r, vr1.vuse, vn_reference_lookup_2, vn_reference_lookup_3, - vuse_ssa_val, &vr1); + vuse_valueize, &vr1); gcc_checking_assert (vr1.operands == shared_lookup_references); if (wvnresult) { -- 2.30.2