Commit b8f6e610 by Martin Jambor Committed by Martin Jambor

ipa-prop.h (ipa_pass_through_data): New field type_preserved.

2013-08-27  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.h (ipa_pass_through_data): New field type_preserved.
	(ipa_ancestor_jf_data): Likewise.
	(ipa_get_jf_pass_through_agg_preserved): Fix comment typo.
	(ipa_get_jf_pass_through_type_preserved): New function.
	(ipa_get_jf_ancestor_agg_preserved): Fix comment typo.
	(ipa_get_jf_ancestor_type_preserved): New function.
	* ipa-cp.c (ipa_get_jf_pass_through_result): Honor type_preserved
	flag.
	(ipa_get_jf_ancestor_result): Likewise.
	(propagate_vals_accross_pass_through): Use
	ipa_get_jf_pass_through_result to do all the value mappings.
	* ipa-prop.c (ipa_print_node_jump_functions_for_edge): Dump the
	type_preserved flag.
	(ipa_set_jf_cst_copy): New function.
	(ipa_set_jf_simple_pass_through): Set the type_preserved flag.
	(ipa_set_jf_arith_pass_through): Likewise.
	(ipa_set_ancestor_jf): Likewise.
	(compute_complex_assign_jump_func): Set type_preserved instead of
	punting.
	(ipa_compute_jump_functions_for_edge): Likewise.
	(combine_known_type_and_ancestor_jfs): Honor type_preserved.
	(update_jump_functions_after_inlining): Update type_preserved.
	Explicitely create jump functions when combining one with
	pass_through.
	(ipa_write_jump_function): Stream the type_preserved flags.
	(ipa_read_jump_function): Likewise.

From-SVN: r202036
parent 74bf76ed
2013-08-27 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (ipa_pass_through_data): New field type_preserved.
(ipa_ancestor_jf_data): Likewise.
(ipa_get_jf_pass_through_agg_preserved): Fix comment typo.
(ipa_get_jf_pass_through_type_preserved): New function.
(ipa_get_jf_ancestor_agg_preserved): Fix comment typo.
(ipa_get_jf_ancestor_type_preserved): New function.
* ipa-cp.c (ipa_get_jf_pass_through_result): Honor type_preserved
flag.
(ipa_get_jf_ancestor_result): Likewise.
(propagate_vals_accross_pass_through): Use
ipa_get_jf_pass_through_result to do all the value mappings.
* ipa-prop.c (ipa_print_node_jump_functions_for_edge): Dump the
type_preserved flag.
(ipa_set_jf_cst_copy): New function.
(ipa_set_jf_simple_pass_through): Set the type_preserved flag.
(ipa_set_jf_arith_pass_through): Likewise.
(ipa_set_ancestor_jf): Likewise.
(compute_complex_assign_jump_func): Set type_preserved instead of
punting.
(ipa_compute_jump_functions_for_edge): Likewise.
(combine_known_type_and_ancestor_jfs): Honor type_preserved.
(update_jump_functions_after_inlining): Update type_preserved.
Explicitely create jump functions when combining one with
pass_through.
(ipa_write_jump_function): Stream the type_preserved flags.
(ipa_read_jump_function): Likewise.
2013-08-27 Jakub Jelinek <jakub@redhat.com>
Aldy Hernandez <aldyh@redhat.com>
......
......@@ -745,17 +745,26 @@ initialize_node_lattices (struct cgraph_node *node)
/* Return the result of a (possibly arithmetic) pass through jump function
JFUNC on the constant value INPUT. Return NULL_TREE if that cannot be
determined or itself is considered an interprocedural invariant. */
determined or be considered an interprocedural invariant. */
static tree
ipa_get_jf_pass_through_result (struct ipa_jump_func *jfunc, tree input)
{
tree restype, res;
if (TREE_CODE (input) == TREE_BINFO)
{
if (ipa_get_jf_pass_through_type_preserved (jfunc))
{
gcc_checking_assert (ipa_get_jf_pass_through_operation (jfunc)
== NOP_EXPR);
return input;
}
return NULL_TREE;
}
if (ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR)
return input;
else if (TREE_CODE (input) == TREE_BINFO)
return NULL_TREE;
gcc_checking_assert (is_gimple_ip_invariant (input));
if (TREE_CODE_CLASS (ipa_get_jf_pass_through_operation (jfunc))
......@@ -779,9 +788,13 @@ static tree
ipa_get_jf_ancestor_result (struct ipa_jump_func *jfunc, tree input)
{
if (TREE_CODE (input) == TREE_BINFO)
return get_binfo_at_offset (input,
ipa_get_jf_ancestor_offset (jfunc),
ipa_get_jf_ancestor_type (jfunc));
{
if (!ipa_get_jf_ancestor_type_preserved (jfunc))
return NULL;
return get_binfo_at_offset (input,
ipa_get_jf_ancestor_offset (jfunc),
ipa_get_jf_ancestor_type (jfunc));
}
else if (TREE_CODE (input) == ADDR_EXPR)
{
tree t = TREE_OPERAND (input, 0);
......@@ -1013,26 +1026,16 @@ propagate_vals_accross_pass_through (struct cgraph_edge *cs,
struct ipcp_value *src_val;
bool ret = false;
if (ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR)
for (src_val = src_lat->values; src_val; src_val = src_val->next)
ret |= add_scalar_value_to_lattice (dest_lat, src_val->value, cs,
src_val, src_idx);
/* Do not create new values when propagating within an SCC because if there
are arithmetic functions with circular dependencies, there is infinite
number of them and we would just make lattices bottom. */
else if (edge_within_scc (cs))
if ((ipa_get_jf_pass_through_operation (jfunc) != NOP_EXPR)
and edge_within_scc (cs))
ret = set_lattice_contains_variable (dest_lat);
else
for (src_val = src_lat->values; src_val; src_val = src_val->next)
{
tree cstval = src_val->value;
if (TREE_CODE (cstval) == TREE_BINFO)
{
ret |= set_lattice_contains_variable (dest_lat);
continue;
}
cstval = ipa_get_jf_pass_through_result (jfunc, cstval);
tree cstval = ipa_get_jf_pass_through_result (jfunc, src_val->value);
if (cstval)
ret |= add_scalar_value_to_lattice (dest_lat, cstval, cs, src_val,
......
......@@ -117,7 +117,12 @@ struct GTY(()) ipa_pass_through_data
aggregate part of the jump function (see description of
ipa_agg_jump_function). The flag is used only when the operation is
NOP_EXPR. */
bool agg_preserved;
unsigned agg_preserved : 1;
/* When set to true, we guarantee that, if there is a C++ object pointed to
by this object, it does not undergo dynamic type change in the course of
functions decribed by this jump function. */
unsigned type_preserved : 1;
};
/* Structure holding data required to describe an ancestor pass-through
......@@ -132,7 +137,11 @@ struct GTY(()) ipa_ancestor_jf_data
/* Number of the caller's formal parameter being passed. */
int formal_id;
/* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */
bool agg_preserved;
unsigned agg_preserved : 1;
/* When set to true, we guarantee that, if there is a C++ object pointed to
by this object, it does not undergo dynamic type change in the course of
functions decribed by this jump function. */
unsigned type_preserved : 1;
};
/* An element in an aggegate part of a jump function describing a known value
......@@ -264,7 +273,7 @@ ipa_get_jf_pass_through_operation (struct ipa_jump_func *jfunc)
return jfunc->value.pass_through.operation;
}
/* Return the agg_preserved flag of a pass through jump functin JFUNC. */
/* Return the agg_preserved flag of a pass through jump function JFUNC. */
static inline bool
ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc)
......@@ -273,6 +282,15 @@ ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc)
return jfunc->value.pass_through.agg_preserved;
}
/* Return the type_preserved flag of a pass through jump function JFUNC. */
static inline bool
ipa_get_jf_pass_through_type_preserved (struct ipa_jump_func *jfunc)
{
gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH);
return jfunc->value.pass_through.type_preserved;
}
/* Return the offset of an ancestor jump function JFUNC. */
static inline HOST_WIDE_INT
......@@ -301,7 +319,7 @@ ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc)
return jfunc->value.ancestor.formal_id;
}
/* Return the agg_preserved flag of an ancestor jump functin JFUNC. */
/* Return the agg_preserved flag of an ancestor jump function JFUNC. */
static inline bool
ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc)
......@@ -310,6 +328,15 @@ ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc)
return jfunc->value.ancestor.agg_preserved;
}
/* Return the type_preserved flag of an ancestor jump function JFUNC. */
static inline bool
ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc)
{
gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR);
return jfunc->value.ancestor.type_preserved;
}
/* Summary describing a single formal parameter. */
struct ipa_param_descriptor
......
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