This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][alias-improvements] Fix DSE
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Dec 2008 23:41:17 +0100 (CET)
- Subject: [PATCH][alias-improvements] Fix DSE
This fixes a bug in DSE. bitmap_{loaded,stored}_syms no longer has
the VOP recorded, so the logic in DSE is wrong. Simply fixed by
asking the oracle.
This allows some more DSE to happen and fixes some testcases.
Richard.
2008-12-09 Richard Guenther <rguenther@suse.de>
* tree-ssa-dse.c (dse_optimize_stmt): Properly query if the rhs
aliases the lhs in a copy stmt.
Index: gcc/tree-ssa-dse.c
===================================================================
--- gcc/tree-ssa-dse.c (revision 142591)
+++ gcc/tree-ssa-dse.c (working copy)
@@ -461,9 +461,12 @@ dse_optimize_stmt (struct dom_walk_data
*p = *u; *p = *v; where p might be v, then USE_STMT
acts as a use as well as definition, so store in STMT
is not dead. */
- if (gimple_loaded_syms (use_stmt)
- && bitmap_intersect_p (gimple_loaded_syms (use_stmt),
- gimple_stored_syms (use_stmt)))
+ if (!is_gimple_reg (gimple_assign_rhs1 (use_stmt))
+ && !is_gimple_min_invariant (gimple_assign_rhs1 (use_stmt))
+ /* ??? Should {} be invariant? */
+ && !gimple_assign_rhs_code (use_stmt) != CONSTRUCTOR
+ && refs_may_alias_p (gimple_assign_lhs (use_stmt),
+ gimple_assign_rhs1 (use_stmt)))
{
record_voperand_set (dse_gd->stores, &bd->stores,
gimple_uid (stmt));