summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-27 21:41:15 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-27 21:41:15 +0000
commitad4a8b286d1c7e0c6091d86610db36276c7bb68c (patch)
treea2d5071d970254c4acebb2d4c7039bfa0e43d18a /gcc/ipa-cp.c
parent3d483a945121cb0af4aca43631e2454f50c9325a (diff)
downloadgcc-ad4a8b286d1c7e0c6091d86610db36276c7bb68c.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202036 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 93934e20de8..78dee15aad8 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -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,