summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-13 10:16:09 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-13 10:16:09 +0000
commit096295f6c740cd12cd5257029ae9c08b7bdd22ac (patch)
treeeb36587215072023d7faafc93b4cb03eb6f629f3 /gcc/ipa-cp.c
parent3a4070617292f52b9ca14427d834abd998ced5f1 (diff)
downloadgcc-096295f6c740cd12cd5257029ae9c08b7bdd22ac.tar.gz
2013-05-13 Martin Jambor <mjambor@suse.cz>
PR middle-end/42371 * ipa-prop.h (IPA_UNDESCRIBED_USE): New macro. (ipa_constant_data): New type. (ipa_jump_func): Use ipa_constant_data to hold information about constant jump functions. (ipa_get_jf_constant): Adjust to jump function type changes. (ipa_get_jf_constant_rdesc): New function. (ipa_param_descriptor): New field controlled_uses. (ipa_get_controlled_uses): New function. (ipa_set_controlled_uses): Likewise. * ipa-ref.h (ipa_find_reference): Declare. * ipa-prop.c (ipa_cst_ref_desc): New type. (ipa_print_node_jump_functions_for_edge): Adjust for jump function type changes. (ipa_set_jf_constant): Likewise. Also create reference descriptions. New parameter cs. Adjust all callers. (ipa_analyze_params_uses): Detect uncontrolled and controlled uses. (remove_described_reference): New function. (jfunc_rdesc_usable): Likewise. (try_make_edge_direct_simple_call): Decrement controlled use count, attempt to remove reference if it hits zero. (combine_controlled_uses_counters): New function. (propagate_controlled_uses): Likewise. (ipa_propagate_indirect_call_infos): Call propagate_controlled_uses. (ipa_edge_duplication_hook): Duplicate reference descriptions. (ipa_print_node_params): Print described use counter. (ipa_write_jump_function): Adjust to jump function type changes. (ipa_read_jump_function): New parameter CS, pass it to ipa_set_jf_constant. Adjust caller. (ipa_write_node_info): Stream controlled use count (ipa_read_node_info): Likewise. * cgraph.c (cgraph_mark_address_taken_node): Bail out instead of asserting. * ipa-cp.c (ipcp_discover_new_direct_edges): Decrement controlled use count. Remove cloning-added reference if it reaches zero. * ipa-ref.c (ipa_find_reference): New function. testsuite/ * gcc.dg/ipa/remref-0.c: New test. * gcc.dg/ipa/remref-1a.c: Likewise. * gcc.dg/ipa/remref-1b.c: Likewise. * gcc.dg/ipa/remref-2a.c: Likewise. * gcc.dg/ipa/remref-2b.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198821 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index f16bd1aa5b5..98c91ef38e7 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -2276,8 +2276,36 @@ ipcp_discover_new_direct_edges (struct cgraph_node *node,
aggvals);
if (target)
{
- ipa_make_edge_direct_to_target (ie, target);
+ struct cgraph_edge *cs = ipa_make_edge_direct_to_target (ie, target);
found = true;
+
+ if (cs && !ie->indirect_info->agg_contents
+ && !ie->indirect_info->polymorphic)
+ {
+ struct ipa_node_params *info = IPA_NODE_REF (node);
+ int param_index = ie->indirect_info->param_index;
+ int c = ipa_get_controlled_uses (info, param_index);
+ if (c != IPA_UNDESCRIBED_USE)
+ {
+ struct ipa_ref *to_del;
+
+ c--;
+ ipa_set_controlled_uses (info, param_index, c);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " controlled uses count of param "
+ "%i bumped down to %i\n", param_index, c);
+ if (c == 0
+ && (to_del = ipa_find_reference ((symtab_node) node,
+ (symtab_node) cs->callee,
+ NULL)))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " and even removing its "
+ "cloning-created reference\n");
+ ipa_remove_reference (to_del);
+ }
+ }
+ }
}
}
/* Turning calls to direct calls will improve overall summary. */