summaryrefslogtreecommitdiff
path: root/gcc/tree-loop-distribution.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-03 16:35:13 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-03 16:35:13 +0000
commit577982d87ba0f4f257fc25479992e1ada6d6fbc1 (patch)
tree75cc50bc2dd573fa0fb793f5893a75c402a2f445 /gcc/tree-loop-distribution.c
parent2c3933b87b056dce86c72fc95813f10d528e1a50 (diff)
downloadgcc-577982d87ba0f4f257fc25479992e1ada6d6fbc1.tar.gz
2008-11-03 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/36908 * testsuite/gcc.dg/tree-ssa/pr36908.c: New. * tree-loop-distribution.c (number_of_rw_in_rdg): New. (number_of_rw_in_partition): New. (partition_contains_all_rw): New. (ldist_gen): Do not distribute when one of the partitions contains all the memory operations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141550 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r--gcc/tree-loop-distribution.c61
1 files changed, 60 insertions, 1 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index ed54cf32730..bd6a9322500 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -945,6 +945,64 @@ debug_rdg_partitions (VEC (bitmap, heap) *partitions)
dump_rdg_partitions (stderr, partitions);
}
+/* Returns the number of read and write operations in the RDG. */
+
+static int
+number_of_rw_in_rdg (struct graph *rdg)
+{
+ int i, res = 0;
+
+ for (i = 0; i < rdg->n_vertices; i++)
+ {
+ if (RDG_MEM_WRITE_STMT (rdg, i))
+ ++res;
+
+ if (RDG_MEM_READS_STMT (rdg, i))
+ ++res;
+ }
+
+ return res;
+}
+
+/* Returns the number of read and write operations in a PARTITION of
+ the RDG. */
+
+static int
+number_of_rw_in_partition (struct graph *rdg, bitmap partition)
+{
+ int res = 0;
+ unsigned i;
+ bitmap_iterator ii;
+
+ EXECUTE_IF_SET_IN_BITMAP (partition, 0, i, ii)
+ {
+ if (RDG_MEM_WRITE_STMT (rdg, i))
+ ++res;
+
+ if (RDG_MEM_READS_STMT (rdg, i))
+ ++res;
+ }
+
+ return res;
+}
+
+/* Returns true when one of the PARTITIONS contains all the read or
+ write operations of RDG. */
+
+static bool
+partition_contains_all_rw (struct graph *rdg, VEC (bitmap, heap) *partitions)
+{
+ int i;
+ bitmap partition;
+ int nrw = number_of_rw_in_rdg (rdg);
+
+ for (i = 0; VEC_iterate (bitmap, partitions, i, partition); i++)
+ if (nrw == number_of_rw_in_partition (rdg, partition))
+ return true;
+
+ return false;
+}
+
/* Generate code from STARTING_VERTICES in RDG. Returns the number of
distributed loops. */
@@ -992,7 +1050,8 @@ ldist_gen (struct loop *loop, struct graph *rdg,
BITMAP_FREE (processed);
nbp = VEC_length (bitmap, partitions);
- if (nbp <= 1)
+ if (nbp <= 1
+ || partition_contains_all_rw (rdg, partitions))
goto ldist_done;
if (dump_file && (dump_flags & TDF_DETAILS))