summaryrefslogtreecommitdiff
path: root/gcc/tree-loop-distribution.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-09-30 12:22:00 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-09-30 12:22:00 +0000
commit734233158b5239eba1b999e053d560509b2239f4 (patch)
tree14ae4862a70d9aa3e0fc5cebe6c7a743ce4249e8 /gcc/tree-loop-distribution.c
parent4b23d68ed0fd9e5ac142a5e6c3273fdf82eec0f6 (diff)
downloadgcc-734233158b5239eba1b999e053d560509b2239f4.tar.gz
2013-09-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/58554 * tree-loop-distribution.c (classify_partition): Require unconditionally executed stores for memcpy and memset recognition. (tree_loop_distribution): Calculate dominance info. * gcc.dg/torture/pr58554.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203031 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r--gcc/tree-loop-distribution.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index b7cafeaa62a..964131a1950 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -1206,7 +1206,9 @@ classify_partition (loop_p loop, struct graph *rdg, partition_t partition)
&& !SSA_NAME_IS_DEFAULT_DEF (rhs)
&& flow_bb_inside_loop_p (loop, gimple_bb (SSA_NAME_DEF_STMT (rhs))))
return;
- if (!adjacent_dr_p (single_store))
+ if (!adjacent_dr_p (single_store)
+ || !dominated_by_p (CDI_DOMINATORS,
+ loop->latch, gimple_bb (stmt)))
return;
partition->kind = PKIND_MEMSET;
partition->main_dr = single_store;
@@ -1222,7 +1224,9 @@ classify_partition (loop_p loop, struct graph *rdg, partition_t partition)
if (!adjacent_dr_p (single_store)
|| !adjacent_dr_p (single_load)
|| !operand_equal_p (DR_STEP (single_store),
- DR_STEP (single_load), 0))
+ DR_STEP (single_load), 0)
+ || !dominated_by_p (CDI_DOMINATORS,
+ loop->latch, gimple_bb (store)))
return;
/* Now check that if there is a dependence this dependence is
of a suitable form for memmove. */
@@ -1719,6 +1723,7 @@ out:
{
if (!cd)
{
+ calculate_dominance_info (CDI_DOMINATORS);
calculate_dominance_info (CDI_POST_DOMINATORS);
cd = new control_dependences (create_edge_list ());
free_dominance_info (CDI_POST_DOMINATORS);