aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-store-merging.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-11-10 11:31:34 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-11-10 11:31:34 +0100
commit9e875fd864e1ddf636c015a35985bccf732b645a (patch)
treeac79b494ba41511f81d5483931023674f728e156 /gcc/gimple-ssa-store-merging.c
parentdb489777bb0185e64cf4b9b8c7afed4dcc6669bd (diff)
downloadgcc-9e875fd864e1ddf636c015a35985bccf732b645a.zip
gcc-9e875fd864e1ddf636c015a35985bccf732b645a.tar.gz
gcc-9e875fd864e1ddf636c015a35985bccf732b645a.tar.bz2
re PR bootstrap/82916 (gcc miscompiled during stagefeedback (PGO bootstrap))
PR bootstrap/82916 * gimple-ssa-store-merging.c (pass_store_merging::terminate_all_aliasing_chains): For gimple_store_p stmts also call refs_output_dependent_p. * gcc.dg/store_merging_2.c: Only expect 2 successful mergings instead of 3. * gcc.dg/pr82916.c: New test. From-SVN: r254623
Diffstat (limited to 'gcc/gimple-ssa-store-merging.c')
-rw-r--r--gcc/gimple-ssa-store-merging.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index 421498b..a5ee7aa 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -947,6 +947,7 @@ pass_store_merging::terminate_all_aliasing_chains (imm_store_chain_info
if (!gimple_vuse (stmt))
return false;
+ tree store_lhs = gimple_store_p (stmt) ? gimple_get_lhs (stmt) : NULL_TREE;
for (imm_store_chain_info *next = m_stores_head, *cur = next; cur; cur = next)
{
next = cur->next;
@@ -960,8 +961,10 @@ pass_store_merging::terminate_all_aliasing_chains (imm_store_chain_info
unsigned int i;
FOR_EACH_VEC_ELT (cur->m_store_info, i, info)
{
- if (ref_maybe_used_by_stmt_p (stmt, gimple_assign_lhs (info->stmt))
- || stmt_may_clobber_ref_p (stmt, gimple_assign_lhs (info->stmt)))
+ tree lhs = gimple_assign_lhs (info->stmt);
+ if (ref_maybe_used_by_stmt_p (stmt, lhs)
+ || stmt_may_clobber_ref_p (stmt, lhs)
+ || (store_lhs && refs_output_dependent_p (store_lhs, lhs)))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{