summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r--gcc/tree-ssa-dse.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index be440c9b657..80c2622c9dc 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -301,8 +301,9 @@ dse_optimize_stmt (struct dse_global_data *dse_gd,
virtual uses from stmt and the stmt which stores to that same
memory location, then we may have found redundant store. */
if (bitmap_bit_p (dse_gd->stores, get_stmt_uid (use_stmt))
- && operand_equal_p (gimple_assign_lhs (stmt),
- gimple_assign_lhs (use_stmt), 0))
+ && (operand_equal_p (gimple_assign_lhs (stmt),
+ gimple_assign_lhs (use_stmt), 0)
+ || stmt_kills_ref_p (use_stmt, gimple_assign_lhs (stmt))))
{
/* If use_stmt is or might be a nop assignment, e.g. for
struct { ... } S a, b, *p; ...