re PR tree-optimization/58432 (ICE: in insert_value_copy_on_edge, at tree-outof-ssa...
authorRichard Biener <rguenther@suse.de>
Tue, 17 Sep 2013 07:47:49 +0000 (07:47 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 17 Sep 2013 07:47:49 +0000 (07:47 +0000)
2013-09-17  Richard Biener  <rguenther@suse.de>

PR tree-optimization/58432
* tree-loop-distribution.c (tree_loop_distribution): Also
scan PHIs for outside loop uses and seed a partition from them.

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

From-SVN: r202644

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

index ebb3564381e3bb0988399947dee3454ad3f89209..6c75db04de1e7382bddd98ee80d4789207418d5b 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-17  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58432
+       * tree-loop-distribution.c (tree_loop_distribution): Also
+       scan PHIs for outside loop uses and seed a partition from them.
+
 2013-09-17  Bin Cheng  <bin.cheng@arm.com>
 
        * gimple-ssa-strength-reduction.c (backtrace_base_for_ref): New.
index fedd45760bb8fb5e319701875dcb086db6404588..050e2206caa4078a89eaf7d7b530cce492f0c785 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-17  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/58432
+       * gcc.dg/pr58432.c: New testcase.
+
 2013-09-17  Bin Cheng  <bin.cheng@arm.com>
 
        * gcc.dg/tree-ssa/slsr-39.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr58432.c b/gcc/testsuite/gcc.dg/pr58432.c
new file mode 100644 (file)
index 0000000..22a720f
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-require-profiling "-fprofile-generate" } */
+/* { dg-options "-O3 -fprofile-generate" } */
+
+struct {
+    int prefix;
+    int dir_idx;
+} *a;
+int b;
+void fn1() {
+    int *c, *d;
+    for (; b; b++)
+      if (d[b]) {
+         c[b] = d[b];
+         a[0].dir_idx = 0;
+      }
+}
index e3e4e12b0256c33bddce54e31e4c8ce8cc2cb735..7482d8c68bc48973f06882d237b84a93e73b9e4c 100644 (file)
@@ -1676,6 +1676,17 @@ tree_loop_distribution (void)
       for (i = 0; i < loop->num_nodes; ++i)
        {
          gimple_stmt_iterator gsi;
+         for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+           {
+             gimple phi = gsi_stmt (gsi);
+             if (virtual_operand_p (gimple_phi_result (phi)))
+               continue;
+             /* Distribute stmts which have defs that are used outside of
+                the loop.  */
+             if (!stmt_has_scalar_dependences_outside_loop (loop, phi))
+               continue;
+             work_list.safe_push (phi);
+           }
          for (gsi = gsi_start_bb (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
            {
              gimple stmt = gsi_stmt (gsi);