aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 726294e..5b78ba4 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -2230,11 +2230,12 @@ vn_reference_lookup_pieces (tree vuse, alias_set_type set, tree type,
number if it exists in the hash table. Return NULL_TREE if it does
not exist in the hash table or if the result field of the structure
was NULL.. VNRESULT will be filled in with the vn_reference_t
- stored in the hashtable if one exists. */
+ stored in the hashtable if one exists. When TBAA_P is false assume
+ we are looking up a store and treat it as having alias-set zero. */
tree
vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind,
- vn_reference_t *vnresult)
+ vn_reference_t *vnresult, bool tbaa_p)
{
vec<vn_reference_op_s> operands;
struct vn_reference_s vr1;
@@ -2264,6 +2265,8 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind,
|| !ao_ref_init_from_vn_reference (&r, vr1.set, vr1.type,
vr1.operands))
ao_ref_init (&r, op);
+ if (! tbaa_p)
+ r.ref_alias_set = r.base_alias_set = 0;
vn_walk_kind = kind;
wvnresult =
(vn_reference_t)walk_non_aliased_vuses (&r, vr1.vuse,
@@ -3350,7 +3353,7 @@ visit_reference_op_load (tree lhs, tree op, gimple *stmt)
last_vuse = gimple_vuse (stmt);
last_vuse_ptr = &last_vuse;
result = vn_reference_lookup (op, gimple_vuse (stmt),
- default_vn_walk_kind, NULL);
+ default_vn_walk_kind, NULL, true);
last_vuse_ptr = NULL;
/* We handle type-punning through unions by value-numbering based
@@ -3472,7 +3475,7 @@ visit_reference_op_store (tree lhs, tree op, gimple *stmt)
Otherwise, the vdefs for the store are used when inserting into
the table, since the store generates a new memory state. */
- result = vn_reference_lookup (lhs, vuse, VN_NOWALK, NULL);
+ result = vn_reference_lookup (lhs, vuse, VN_NOWALK, NULL, false);
if (result)
{
@@ -3487,7 +3490,7 @@ visit_reference_op_store (tree lhs, tree op, gimple *stmt)
&& default_vn_walk_kind == VN_WALK)
{
assign = build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, op);
- vn_reference_lookup (assign, vuse, VN_NOWALK, &vnresult);
+ vn_reference_lookup (assign, vuse, VN_NOWALK, &vnresult, false);
if (vnresult)
{
VN_INFO (vdef)->use_processed = true;