summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-09-17 07:47:49 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-09-17 07:47:49 +0000
commit157cd65f8f218bfa79ae6765409f6bb122e71496 (patch)
tree5503f1fa8c1ef7d6aec0b94ebada2f7c4bcb7308 /gcc
parent3f8e75547a9af18ed9e2da238869b34f8e651553 (diff)
downloadgcc-157cd65f8f218bfa79ae6765409f6bb122e71496.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202644 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr58432.c17
-rw-r--r--gcc/tree-loop-distribution.c11
4 files changed, 39 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ebb3564381e..6c75db04de1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fedd45760bb..050e2206caa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..22a720f142f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr58432.c
@@ -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;
+ }
+}
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index e3e4e12b025..7482d8c68bc 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -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);