Commit 82d49829 by Martin Jambor Committed by Martin Jambor

ipa-prop.h (struct ipa_parm_adjustment): New field alias_ptr_type.

2010-12-09  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.h (struct ipa_parm_adjustment): New field alias_ptr_type.
	* ipa-prop.c (ipa_modify_call_arguments): Use it.
	* tree-sra.c (splice_param_accesses): Test that all accesses have the
	same alias reference type.
	(turn_representatives_into_adjustments): Set alias_ptr_type of the
	adjustment.

From-SVN: r167641
parent 544ae3f5
2010-12-09 Martin Jambor <mjambor@suse.cz> 2010-12-09 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (struct ipa_parm_adjustment): New field alias_ptr_type.
* ipa-prop.c (ipa_modify_call_arguments): Use it.
* tree-sra.c (splice_param_accesses): Test that all accesses have the
same alias reference type.
(turn_representatives_into_adjustments): Set alias_ptr_type of the
adjustment.
2010-12-09 Martin Jambor <mjambor@suse.cz>
PR middle-end/46734 PR middle-end/46734
* tree-sra.c (splice_param_accesses): Check that there are not * tree-sra.c (splice_param_accesses): Check that there are not
multiple ADDRESSABLE types. multiple ADDRESSABLE types.
...@@ -2210,13 +2210,10 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, ...@@ -2210,13 +2210,10 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
base = gimple_call_arg (stmt, adj->base_index); base = gimple_call_arg (stmt, adj->base_index);
loc = EXPR_LOCATION (base); loc = EXPR_LOCATION (base);
if (TREE_CODE (base) == ADDR_EXPR if (TREE_CODE (base) != ADDR_EXPR
&& DECL_P (TREE_OPERAND (base, 0)))
off = build_int_cst (TREE_TYPE (base),
adj->offset / BITS_PER_UNIT);
else if (TREE_CODE (base) != ADDR_EXPR
&& POINTER_TYPE_P (TREE_TYPE (base))) && POINTER_TYPE_P (TREE_TYPE (base)))
off = build_int_cst (TREE_TYPE (base), adj->offset / BITS_PER_UNIT); off = build_int_cst (adj->alias_ptr_type,
adj->offset / BITS_PER_UNIT);
else else
{ {
HOST_WIDE_INT base_offset; HOST_WIDE_INT base_offset;
...@@ -2230,12 +2227,12 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, ...@@ -2230,12 +2227,12 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
if (!base) if (!base)
{ {
base = build_fold_addr_expr (prev_base); base = build_fold_addr_expr (prev_base);
off = build_int_cst (reference_alias_ptr_type (prev_base), off = build_int_cst (adj->alias_ptr_type,
adj->offset / BITS_PER_UNIT); adj->offset / BITS_PER_UNIT);
} }
else if (TREE_CODE (base) == MEM_REF) else if (TREE_CODE (base) == MEM_REF)
{ {
off = build_int_cst (TREE_TYPE (TREE_OPERAND (base, 1)), off = build_int_cst (adj->alias_ptr_type,
base_offset base_offset
+ adj->offset / BITS_PER_UNIT); + adj->offset / BITS_PER_UNIT);
off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1), off = int_const_binop (PLUS_EXPR, TREE_OPERAND (base, 1),
...@@ -2244,7 +2241,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, ...@@ -2244,7 +2241,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
} }
else else
{ {
off = build_int_cst (reference_alias_ptr_type (prev_base), off = build_int_cst (adj->alias_ptr_type,
base_offset base_offset
+ adj->offset / BITS_PER_UNIT); + adj->offset / BITS_PER_UNIT);
base = build_fold_addr_expr (base); base = build_fold_addr_expr (base);
......
...@@ -458,6 +458,10 @@ struct ipa_parm_adjustment ...@@ -458,6 +458,10 @@ struct ipa_parm_adjustment
be a pointer to this type. */ be a pointer to this type. */
tree type; tree type;
/* Alias refrerence type to be used in MEM_REFs when adjusting caller
arguments. */
tree alias_ptr_type;
/* The new declaration when creating/replacing a parameter. Created by /* The new declaration when creating/replacing a parameter. Created by
ipa_modify_formal_parameters, useful for functions modifying the body ipa_modify_formal_parameters, useful for functions modifying the body
accordingly. */ accordingly. */
......
...@@ -3563,10 +3563,12 @@ splice_param_accesses (tree parm, bool *ro_grp) ...@@ -3563,10 +3563,12 @@ splice_param_accesses (tree parm, bool *ro_grp)
while (i < access_count) while (i < access_count)
{ {
bool modification; bool modification;
tree a1_alias_type;
access = VEC_index (access_p, access_vec, i); access = VEC_index (access_p, access_vec, i);
modification = access->write; modification = access->write;
if (access_precludes_ipa_sra_p (access)) if (access_precludes_ipa_sra_p (access))
return NULL; return NULL;
a1_alias_type = reference_alias_ptr_type (access->expr);
/* Access is about to become group representative unless we find some /* Access is about to become group representative unless we find some
nasty overlap which would preclude us from breaking this parameter nasty overlap which would preclude us from breaking this parameter
...@@ -3590,7 +3592,8 @@ splice_param_accesses (tree parm, bool *ro_grp) ...@@ -3590,7 +3592,8 @@ splice_param_accesses (tree parm, bool *ro_grp)
if (access_precludes_ipa_sra_p (ac2) if (access_precludes_ipa_sra_p (ac2)
|| (ac2->type != access->type || (ac2->type != access->type
&& (TREE_ADDRESSABLE (ac2->type) && (TREE_ADDRESSABLE (ac2->type)
|| TREE_ADDRESSABLE (access->type)))) || TREE_ADDRESSABLE (access->type)))
|| (reference_alias_ptr_type (ac2->expr) != a1_alias_type))
return NULL; return NULL;
modification |= ac2->write; modification |= ac2->write;
...@@ -3825,6 +3828,7 @@ turn_representatives_into_adjustments (VEC (access_p, heap) *representatives, ...@@ -3825,6 +3828,7 @@ turn_representatives_into_adjustments (VEC (access_p, heap) *representatives,
adj->base_index = index; adj->base_index = index;
adj->base = repr->base; adj->base = repr->base;
adj->type = repr->type; adj->type = repr->type;
adj->alias_ptr_type = reference_alias_ptr_type (repr->expr);
adj->offset = repr->offset; adj->offset = repr->offset;
adj->by_ref = (POINTER_TYPE_P (TREE_TYPE (repr->base)) adj->by_ref = (POINTER_TYPE_P (TREE_TYPE (repr->base))
&& (repr->grp_maybe_modified && (repr->grp_maybe_modified
......
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