Commit 14cd91f9 by Richard Guenther Committed by Richard Biener

tree-ssa-alias.h (struct ao_ref_s): Add volatile_p field.

2011-12-05  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-alias.h (struct ao_ref_s): Add volatile_p field.
	* tree-ssa-alias.c (ao_ref_init): Initialize it.
	(ao_ref_init_from_ptr_and_size): Likewise.
	(refs_may_alias_p_1): Two volatile accesses conflict.
	(ref_maybe_used_by_call_p_1): Likewise.
	(call_may_clobber_ref_p_1): Likewise.
	* tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Initialize
	volatile_p field.

From-SVN: r182009
parent 68872bed
2011-12-05 Richard Guenther <rguenther@suse.de> 2011-12-05 Richard Guenther <rguenther@suse.de>
* tree-ssa-alias.h (struct ao_ref_s): Add volatile_p field.
* tree-ssa-alias.c (ao_ref_init): Initialize it.
(ao_ref_init_from_ptr_and_size): Likewise.
(refs_may_alias_p_1): Two volatile accesses conflict.
(ref_maybe_used_by_call_p_1): Likewise.
(call_may_clobber_ref_p_1): Likewise.
* tree-ssa-sccvn.c (ao_ref_init_from_vn_reference): Initialize
volatile_p field.
2011-12-05 Richard Guenther <rguenther@suse.de>
* tree-ssa.c (verify_ssa): Verify SSA names in the loop * tree-ssa.c (verify_ssa): Verify SSA names in the loop
over all SSA names. Remove SSA operand checking, call over all SSA names. Remove SSA operand checking, call
verify_ssa_operands. verify_ssa_operands.
...@@ -456,6 +456,7 @@ ao_ref_init (ao_ref *r, tree ref) ...@@ -456,6 +456,7 @@ ao_ref_init (ao_ref *r, tree ref)
r->max_size = -1; r->max_size = -1;
r->ref_alias_set = -1; r->ref_alias_set = -1;
r->base_alias_set = -1; r->base_alias_set = -1;
r->volatile_p = ref ? TREE_THIS_VOLATILE (ref) : false;
} }
/* Returns the base object of the memory reference *REF. */ /* Returns the base object of the memory reference *REF. */
...@@ -525,6 +526,7 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size) ...@@ -525,6 +526,7 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
ref->max_size = ref->size = -1; ref->max_size = ref->size = -1;
ref->ref_alias_set = 0; ref->ref_alias_set = 0;
ref->base_alias_set = 0; ref->base_alias_set = 0;
ref->volatile_p = false;
} }
/* Return 1 if TYPE1 and TYPE2 are to be considered equivalent for the /* Return 1 if TYPE1 and TYPE2 are to be considered equivalent for the
...@@ -1021,6 +1023,11 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) ...@@ -1021,6 +1023,11 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
|| TREE_CODE (base2) == LABEL_DECL) || TREE_CODE (base2) == LABEL_DECL)
return true; return true;
/* Two volatile accesses always conflict. */
if (ref1->volatile_p
&& ref2->volatile_p)
return true;
/* Defer to simple offset based disambiguation if we have /* Defer to simple offset based disambiguation if we have
references based on two decls. Do this before defering to references based on two decls. Do this before defering to
TBAA to handle must-alias cases in conformance with the TBAA to handle must-alias cases in conformance with the
...@@ -1144,6 +1151,11 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) ...@@ -1144,6 +1151,11 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref)
if (!base) if (!base)
return true; return true;
/* A call that is not without side-effects might involve volatile
accesses and thus conflicts with all other volatile accesses. */
if (ref->volatile_p)
return true;
/* If the reference is based on a decl that is not aliased the call /* If the reference is based on a decl that is not aliased the call
cannot possibly use it. */ cannot possibly use it. */
if (DECL_P (base) if (DECL_P (base)
...@@ -1477,6 +1489,11 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) ...@@ -1477,6 +1489,11 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
|| CONSTANT_CLASS_P (base)) || CONSTANT_CLASS_P (base))
return false; return false;
/* A call that is not without side-effects might involve volatile
accesses and thus conflicts with all other volatile accesses. */
if (ref->volatile_p)
return true;
/* If the reference is based on a decl that is not aliased the call /* If the reference is based on a decl that is not aliased the call
cannot possibly clobber it. */ cannot possibly clobber it. */
if (DECL_P (base) if (DECL_P (base)
......
...@@ -86,6 +86,9 @@ typedef struct ao_ref_s ...@@ -86,6 +86,9 @@ typedef struct ao_ref_s
/* The alias set of the base object or -1 if not yet computed. */ /* The alias set of the base object or -1 if not yet computed. */
alias_set_type base_alias_set; alias_set_type base_alias_set;
/* Whether the memory is considered a volatile access. */
bool volatile_p;
} ao_ref; } ao_ref;
......
...@@ -918,6 +918,8 @@ ao_ref_init_from_vn_reference (ao_ref *ref, ...@@ -918,6 +918,8 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
ref->base_alias_set = base_alias_set; ref->base_alias_set = base_alias_set;
else else
ref->base_alias_set = get_alias_set (base); ref->base_alias_set = get_alias_set (base);
/* We discount volatiles from value-numbering elsewhere. */
ref->volatile_p = false;
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment