diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-20 12:21:08 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-20 12:21:08 +0000 |
commit | 0c58611e1ae6bbd4a987083a6b56d3c64f2a2203 (patch) | |
tree | 91acf755102024f37d660f235c7b7e61f82d7a2e /gcc/tree-loop-distribution.c | |
parent | 5fa7ce8ceacd83028cd63988a46f7e1b985b15d8 (diff) | |
download | gcc-0c58611e1ae6bbd4a987083a6b56d3c64f2a2203.tar.gz |
2013-09-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/58453
* tree-loop-distribution.c (distribute_loop): Apply the cost
model for -ftree-loop-distribute-patterns, too.
* gcc.dg/tree-ssa/ldist-23.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202775 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r-- | gcc/tree-loop-distribution.c | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 7482d8c68bc..51b6ef03b4e 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -1514,18 +1514,51 @@ distribute_loop (struct loop *loop, vec<gimple> stmts, any_builtin |= partition_builtin_p (partition); } + /* If we did not detect any builtin but are not asked to apply + regular loop distribution simply bail out. */ + if (!flag_tree_loop_distribution + && !any_builtin) + { + nbp = 0; + goto ldist_done; + } + + /* Apply our simple cost model - fuse partitions with similar + memory accesses. */ + partition_t into; + for (i = 0; partitions.iterate (i, &into); ++i) + { + if (partition_builtin_p (into)) + continue; + for (int j = i + 1; + partitions.iterate (j, &partition); ++j) + { + if (!partition_builtin_p (partition) + && similar_memory_accesses (rdg, into, partition)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "fusing partitions\n"); + dump_bitmap (dump_file, into->stmts); + dump_bitmap (dump_file, partition->stmts); + fprintf (dump_file, "because they have similar " + "memory accesses\n"); + } + bitmap_ior_into (into->stmts, partition->stmts); + if (partition->kind == PKIND_REDUCTION) + into->kind = PKIND_REDUCTION; + partitions.ordered_remove (j); + partition_free (partition); + j--; + } + } + } + /* If we are only distributing patterns fuse all partitions that - were not properly classified as builtins. Else fuse partitions - with similar memory accesses. */ + were not properly classified as builtins. */ if (!flag_tree_loop_distribution) { partition_t into; - /* If we did not detect any builtin simply bail out. */ - if (!any_builtin) - { - nbp = 0; - goto ldist_done; - } /* Only fuse adjacent non-builtin partitions, see PR53616. ??? Use dependence information to improve partition ordering. */ i = 0; @@ -1549,38 +1582,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts, } while ((unsigned) i < partitions.length ()); } - else - { - partition_t into; - int j; - for (i = 0; partitions.iterate (i, &into); ++i) - { - if (partition_builtin_p (into)) - continue; - for (j = i + 1; - partitions.iterate (j, &partition); ++j) - { - if (!partition_builtin_p (partition) - && similar_memory_accesses (rdg, into, partition)) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "fusing partitions\n"); - dump_bitmap (dump_file, into->stmts); - dump_bitmap (dump_file, partition->stmts); - fprintf (dump_file, "because they have similar " - "memory accesses\n"); - } - bitmap_ior_into (into->stmts, partition->stmts); - if (partition->kind == PKIND_REDUCTION) - into->kind = PKIND_REDUCTION; - partitions.ordered_remove (j); - partition_free (partition); - j--; - } - } - } - } /* Fuse all reduction partitions into the last. */ if (partitions.length () > 1) |