aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-09-21 14:04:25 +0200
committerRichard Biener <rguenther@suse.de>2020-09-21 14:06:36 +0200
commit0df746afc50a47d1eb53a401e017c4373cf05641 (patch)
tree8854bff3684494b1d8bf4e6c1dfba501017766e2 /gcc/tree-ssa-loop-im.c
parentd726ecd9554a805d4a5e044cb21ca23a7f7ca49f (diff)
downloadgcc-0df746afc50a47d1eb53a401e017c4373cf05641.zip
gcc-0df746afc50a47d1eb53a401e017c4373cf05641.tar.gz
gcc-0df746afc50a47d1eb53a401e017c4373cf05641.tar.bz2
tree-optimization/97135 - fix dependence check in store-motion
The following fixes a dependence check where in the particular place we cannot ignore self-dependences. 2020-09-21 Richard Biener <rguenther@suse.de> PR tree-optimization/97135 * tree-ssa-loop-im.c (sm_seq_push_down): Do not ignore self-dependences. * gcc.dg/torture/pr97135.c: New testcase.
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index f87c287..139c7e7 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -2232,9 +2232,11 @@ sm_seq_push_down (vec<seq_entry> &seq, unsigned ptr, unsigned *at)
|| (against.second == sm_other && against.from != NULL_TREE))
/* Found the tail of the sequence. */
break;
- if (!refs_independent_p (memory_accesses.refs_list[new_cand.first],
- memory_accesses.refs_list[against.first],
- false))
+ /* We may not ignore self-dependences here. */
+ if (new_cand.first == against.first
+ || !refs_independent_p (memory_accesses.refs_list[new_cand.first],
+ memory_accesses.refs_list[against.first],
+ false))
/* ??? Prune new_cand from the list of refs to apply SM to. */
return false;
std::swap (new_cand, against);