re PR tree-optimization/80158 (ICE in all_phi_incrs_profitable)
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Fri, 24 Mar 2017 12:34:19 +0000 (12:34 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 24 Mar 2017 12:34:19 +0000 (12:34 +0000)
2017-03-24  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

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
gcc/gimple-ssa-strength-reduction.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/pr80158.f [new file with mode: 0644]

index de9cd9036a102d6bbf8cf955edd29bc31e788c95..8d4adfbb07fbcaa9a3275641d56d0087fe79e8ea 100644 (file)
@@ -1,3 +1,12 @@
+2017-03-24  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       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  <rguenther@suse.de>
 
        PR tree-optimization/80167
index ca154c51bfcd7c133d4762bb3322a1438f40f1c6..99978ddc3089ec810f79906f6b3f4a89d3e37318 100644 (file)
@@ -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;
index 78de19e09aaefdaa7e5787c3810dfa11e3c82c90..759d2b3fd3c129c3204d131361f08755fa34933c 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-24  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       PR tree-optimization/80158
+       * gfortran.fortran-torture/compile/pr80158.f: New file.
+
 2017-03-24  Richard Biener  <rguenther@suse.de>
 
        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 (file)
index 0000000..5e3b3f2
--- /dev/null
@@ -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
+