]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/46177 (ICE: in prop_phis, at tree-loop-distribution.c:327...
authorRichard Guenther <rguenther@suse.de>
Tue, 2 Nov 2010 15:45:26 +0000 (15:45 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 2 Nov 2010 15:45:26 +0000 (15:45 +0000)
2010-11-02  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/46177
* tree-loop-distribution.c (prop_phis): Use
mark_virtual_phi_result_for_renaming.

* gcc.dg/pr46177.c: New testcase.

From-SVN: r166193

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr46177.c [new file with mode: 0644]
gcc/tree-loop-distribution.c

index a347b05182c7a2b46c538774baa6e2ea777e2d3c..e1a18afbc4969006e9b5ed2916f22100e017b26a 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-02  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/46177
+       * tree-loop-distribution.c (prop_phis): Use
+       mark_virtual_phi_result_for_renaming.
+
 2010-11-02  Martin Jambor  <mjambor@suse.cz>
 
        PR middle-end/46120
index 471b009da58309425c82581785c0dc1b05343106..4f4e4863a41ae78b476f6edab73838a80dd8cc62 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-02  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/46177
+       * gcc.dg/pr46177.c: New testcase.
+
 2010-11-02  Martin Jambor  <mjambor@suse.cz>
 
        PR middle-end/46120
diff --git a/gcc/testsuite/gcc.dg/pr46177.c b/gcc/testsuite/gcc.dg/pr46177.c
new file mode 100644 (file)
index 0000000..397e316
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-copy-prop -ftree-loop-distribution" } */
+
+extern int A[];
+extern int B[];
+
+void
+foo (int j, int c)
+{
+  int i;
+
+  if (c)
+    for (i = 0; i < j; i++)
+      A[i] = B[i] = 0;
+
+  for (i = 0; i < j; i++)
+    A[i] = B[i];
+}
index 63f717807d480810a6041f95726c7f81fb174342..bc3f54d97d46abaffd278a6f6c7af128e71b9161 100644 (file)
@@ -317,27 +317,20 @@ static void
 prop_phis (basic_block b)
 {
   gimple_stmt_iterator psi;
-  gimple_seq phis = phi_nodes (b);
 
-  for (psi = gsi_start (phis); !gsi_end_p (psi); )
+  for (psi = gsi_start_phis (b); !gsi_end_p (psi); )
     {
       gimple phi = gsi_stmt (psi);
-      tree def = gimple_phi_result (phi), use = gimple_phi_arg_def (phi, 0);
-
-      gcc_assert (gimple_phi_num_args (phi) == 1);
+      tree def = gimple_phi_result (phi);
 
       if (!is_gimple_reg (def))
+       mark_virtual_phi_result_for_renaming (phi);
+      else
        {
-         imm_use_iterator iter;
-         use_operand_p use_p;
-         gimple stmt;
-
-         FOR_EACH_IMM_USE_STMT (stmt, iter, def)
-           FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
-             SET_USE (use_p, use);
+         tree use = gimple_phi_arg_def (phi, 0);
+         gcc_assert (gimple_phi_num_args (phi) == 1);
+         replace_uses_by (def, use);
        }
-      else
-       replace_uses_by (def, use);
 
       remove_phi_node (&psi, true);
     }