This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][alias-improvements] Fix DOM store value-numbering
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 4 Jan 2009 18:07:54 +0100 (CET)
- Subject: [PATCH][alias-improvements] Fix DOM store value-numbering
This fixes the store value-numbering of DOM - it relies on
create_ssa_artificial_load_stmt to put on the same virtual operand
SSA name as on the other stmt - at the initial alias rewrite I broke that.
Fixed thusly.
In refs_may_alias_p we may disambiguate references to distinct types
in case their bases do not conflict. This fixes one piece of the
pr27799.c testsuite fail.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the
branch.
Richard.
2009-01-04 Richard Guenther <rguenther@suse.de>
* tree-dfa.c (refs_may_alias_p): Disambiguate using alias
sets of the bases.
* tree-ssa-operands.c (create_ssa_artificial_load_stmt): Add
the virtual operand in SSA form.
Index: gcc/tree-dfa.c
===================================================================
*** gcc/tree-dfa.c (revision 143048)
--- gcc/tree-dfa.c (working copy)
*************** refs_may_alias_p (tree ref1, tree ref2)
*** 1049,1054 ****
--- 1049,1060 ----
TREE_OPERAND (base2, 0), 0)))
return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
+ /* If the base objects do not conflict, references based on them
+ cannot either. */
+ if (strict_aliasing_applies
+ && !alias_sets_conflict_p (get_alias_set (base1), get_alias_set (base2)))
+ return false;
+
/* If both are component references through pointers try to find a
common base and apply offset based disambiguation. This handles
for example
*************** refs_may_alias_p (tree ref1, tree ref2)
*** 1093,1101 ****
offset1 -= offadj;
return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
}
- /* If we can be sure to catch all equivalent types in the search
- for the common base then we could return false here. In that
- case we would be able to disambiguate q->i and p->k. */
}
return true;
--- 1099,1104 ----
Index: gcc/tree-ssa-operands.c
===================================================================
*** gcc/tree-ssa-operands.c (revision 143048)
--- gcc/tree-ssa-operands.c (working copy)
*************** create_ssa_artificial_load_stmt (gimple
*** 1774,1782 ****
bitmap_clear (build_stores);
/* For each VDEF on the original statement, we want to create a
! VUSE of the VDEF result operand on the new statement. */
FOR_EACH_SSA_TREE_OPERAND (op, old_stmt, iter, SSA_OP_VDEF)
! append_vuse ();
finalize_ssa_stmt_operands (new_stmt);
--- 1774,1783 ----
bitmap_clear (build_stores);
/* For each VDEF on the original statement, we want to create a
! VUSE of the VDEF result operand on the new statement.
! ??? All this function can be simplified very much. */
FOR_EACH_SSA_TREE_OPERAND (op, old_stmt, iter, SSA_OP_VDEF)
! VEC_safe_push (tree, heap, build_vuses, op);
finalize_ssa_stmt_operands (new_stmt);