From 635684c4cf2c3672017cda0df400213b0ca2d10b Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Fri, 24 Mar 2017 12:34:19 +0000 Subject: [PATCH] re PR tree-optimization/80158 (ICE in all_phi_incrs_profitable) 2017-03-24 Bill Schmidt PR tree-optimization/80158 * gimple-ssa-strength-reduction.c (replace_mult_candidate): When replacing a candidate statement, also replace it for the candidate's alternate interpretation. (replace_rhs_if_not_dup): Likewise. (replace_one_candidate): Likewise. * gfortran.fortran-torture/compile/pr80158.f: New file. From-SVN: r246439 --- gcc/ChangeLog | 9 +++++++++ gcc/gimple-ssa-strength-reduction.c | 12 ++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ .../gfortran.fortran-torture/compile/pr80158.f | 16 ++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gfortran.fortran-torture/compile/pr80158.f diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de9cd9036a1..8d4adfbb07f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-03-24 Bill Schmidt + + PR tree-optimization/80158 + * gimple-ssa-strength-reduction.c (replace_mult_candidate): When + replacing a candidate statement, also replace it for the + candidate's alternate interpretation. + (replace_rhs_if_not_dup): Likewise. + (replace_one_candidate): Likewise. + 2017-03-24 Richard Biener PR tree-optimization/80167 diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index ca154c51bfc..99978ddc308 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -2089,6 +2089,8 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, widest_int bump) gimple_set_location (copy_stmt, gimple_location (c->cand_stmt)); gsi_replace (&gsi, copy_stmt, false); c->cand_stmt = copy_stmt; + if (c->next_interp) + lookup_cand (c->next_interp)->cand_stmt = copy_stmt; if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = copy_stmt; } @@ -2118,6 +2120,8 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, widest_int bump) basis_name, bump_tree); update_stmt (gsi_stmt (gsi)); c->cand_stmt = gsi_stmt (gsi); + if (c->next_interp) + lookup_cand (c->next_interp)->cand_stmt = gsi_stmt (gsi); if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = gsi_stmt (gsi); } @@ -3405,6 +3409,8 @@ replace_rhs_if_not_dup (enum tree_code new_code, tree new_rhs1, tree new_rhs2, gimple_assign_set_rhs_with_ops (&gsi, new_code, new_rhs1, new_rhs2); update_stmt (gsi_stmt (gsi)); c->cand_stmt = gsi_stmt (gsi); + if (c->next_interp) + lookup_cand (c->next_interp)->cand_stmt = gsi_stmt (gsi); if (dump_file && (dump_flags & TDF_DETAILS)) return gsi_stmt (gsi); @@ -3511,6 +3517,8 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name) gimple_assign_set_rhs_with_ops (&gsi, MINUS_EXPR, basis_name, rhs2); update_stmt (gsi_stmt (gsi)); c->cand_stmt = gsi_stmt (gsi); + if (c->next_interp) + lookup_cand (c->next_interp)->cand_stmt = gsi_stmt (gsi); if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = gsi_stmt (gsi); @@ -3532,6 +3540,8 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name) gimple_set_location (copy_stmt, gimple_location (c->cand_stmt)); gsi_replace (&gsi, copy_stmt, false); c->cand_stmt = copy_stmt; + if (c->next_interp) + lookup_cand (c->next_interp)->cand_stmt = copy_stmt; if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = copy_stmt; @@ -3543,6 +3553,8 @@ replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name) gimple_set_location (cast_stmt, gimple_location (c->cand_stmt)); gsi_replace (&gsi, cast_stmt, false); c->cand_stmt = cast_stmt; + if (c->next_interp) + lookup_cand (c->next_interp)->cand_stmt = cast_stmt; if (dump_file && (dump_flags & TDF_DETAILS)) stmt_to_print = cast_stmt; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 78de19e09aa..759d2b3fd3c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-24 Bill Schmidt + + PR tree-optimization/80158 + * gfortran.fortran-torture/compile/pr80158.f: New file. + 2017-03-24 Richard Biener PR tree-optimization/80167 diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr80158.f b/gcc/testsuite/gfortran.fortran-torture/compile/pr80158.f new file mode 100644 index 00000000000..5e3b3f24674 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr80158.f @@ -0,0 +1,16 @@ + SUBROUTINE DRPAUL(SMAT,TMAT,EPS,EPT,SIJ,TIJ,WRK,VEC,ARRAY,FMO, + * XMKVIR,TMJ,XMI,YMI,ZMI,ZQQ,L1,L1EF,LNA,LNA2, + * NAEF,L2,NLOC,NVIR,PROVEC,FOCKMA,MXBF,MXMO2) + DIMENSION CMO(L1,L1),TLOC(LNA,LNA),SMJ(L1,NAEF),XMK(L1,LNA) + DO I = 1,LNA + DO J = 1,LNA + IF (I.LE.NOUT) TLOC(I,J) = ZERO + IF (J.LE.NOUT) TLOC(I,J) = ZERO + END DO + DO NA=1,NOC + IF ( ABS(E(NI)-E(NA)) .GE.TOL) THEN + END IF + END DO + END DO + END + -- 2.30.2