summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-10-13 13:03:31 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-10-13 13:03:31 +0000
commit71d61348020eedc3d89e4c877ad714cbb2954792 (patch)
tree1fbb62b9afc53835c17dfb33351b1fa61122bfce /gcc/tree-ssa-dse.c
parent9827eb57a33462935e8d55d7e49f5ab4b16b887c (diff)
downloadgcc-71d61348020eedc3d89e4c877ad714cbb2954792.tar.gz
re PR tree-optimization/45970 (tree DSE misses many obvious dead stores)
2010-10-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/45970 * tree-ssa-alias.h (stmt_kills_ref_p): Declare. * tree-ssa-alias.c (stmt_kills_ref_p_1): New function. (stmt_kills_ref_p): Likewise. * tree-ssa-dse.c (dse_optimize_stmt): Use it. * gcc.dg/tree-ssa/ssa-dse-13.c: New testcase. From-SVN: r165422
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; ...