re PR tree-optimization/60733 (ICE due to SLSR on valid code at -O3 on x86_64-linux...
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Wed, 2 Apr 2014 22:07:30 +0000 (22:07 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Wed, 2 Apr 2014 22:07:30 +0000 (22:07 +0000)
[gcc]

2014-04-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

PR tree-optimization/60733
* gimple-ssa-strength-reduction.c (ncd_with_phi): Change required
insertion point for PHI candidates to be the end of the feeding
block for the PHI argument.

[gcc/testsuite]

2014-04-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

PR tree-optimization/60733
* gcc.dg/torture/pr60733.c:  New test.

From-SVN: r209040

gcc/ChangeLog
gcc/gimple-ssa-strength-reduction.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr60733.c [new file with mode: 0644]

index 1b2f824..6a473c8 100644 (file)
@@ -1,3 +1,10 @@
+2014-04-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       PR tree-optimization/60733
+       * gimple-ssa-strength-reduction.c (ncd_with_phi): Change required
+       insertion point for PHI candidates to be the end of the feeding
+       block for the PHI argument.
+
 2014-04-02  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/60650
index 9320b51..9ad1b4f 100644 (file)
@@ -3001,10 +3001,10 @@ ncd_with_phi (slsr_cand_t c, double_int incr, gimple phi,
            {
              slsr_cand_t arg_cand = base_cand_from_table (arg);
              double_int diff = arg_cand->index - basis->index;
+             basic_block pred = gimple_phi_arg_edge (phi, i)->src;
 
              if ((incr == diff) || (!address_arithmetic_p && incr == -diff))
-               ncd = ncd_for_two_cands (ncd, gimple_bb (arg_cand->cand_stmt),
-                                        *where, arg_cand, where);
+               ncd = ncd_for_two_cands (ncd, pred, *where, NULL, where);
            }
        }
     }
index 2decdf1..cc26f21 100644 (file)
@@ -1,3 +1,8 @@
+2014-04-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       PR tree-optimization/60733
+       * gcc.dg/torture/pr60733.c:  New test.
+
 2014-04-02  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/60650
diff --git a/gcc/testsuite/gcc.dg/torture/pr60733.c b/gcc/testsuite/gcc.dg/torture/pr60733.c
new file mode 100644 (file)
index 0000000..49cc59e
--- /dev/null
@@ -0,0 +1,36 @@
+/* { dg-do run } */
+
+int a, d, e, f, g, h, i, j, k;
+unsigned short b;
+
+short
+fn1 (int p1, int p2)
+{
+  return p1 * p2;
+}
+
+int
+main ()
+{
+  for (; a; a--)
+    {
+      int l = 0;
+      if (f >= 0)
+       {
+         for (; h;)
+           e = 0;
+         for (; l != -6; l--)
+           {
+             j = fn1 (b--, d);
+             for (g = 0; g; g = 1)
+               ;
+             k = e ? 2 : 0;
+           }
+         i = 0;
+         for (;;)
+           ;
+       }
+    }
+  d = 0;
+  return 0;
+}