diff options
author | Martin Jambor <mjambor@suse.cz> | 2013-05-13 12:16:09 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2013-05-13 12:16:09 +0200 |
commit | 4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc (patch) | |
tree | eb36587215072023d7faafc93b4cb03eb6f629f3 /gcc/ipa-ref.c | |
parent | 0864bfc257a3d3198ba182c562b729ba1e96466d (diff) | |
download | gcc-4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc.zip gcc-4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc.tar.gz gcc-4502fe8dfcb1cc2c59b50b868ac75fb5cdd742fc.tar.bz2 |
re PR middle-end/42371 (dead code not eliminated during folding with whole-program)
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.
From-SVN: r198821
Diffstat (limited to 'gcc/ipa-ref.c')
-rw-r--r-- | gcc/ipa-ref.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ipa-ref.c b/gcc/ipa-ref.c index 044e237..d6ac25f 100644 --- a/gcc/ipa-ref.c +++ b/gcc/ipa-ref.c @@ -198,3 +198,20 @@ ipa_ref_has_aliases_p (struct ipa_ref_list *ref_list) return true; return false; } + +/* Find the structure describing a reference in REFERRING_NODE to REFERRED_NODE + and associated with statement STMT. */ + +struct ipa_ref * +ipa_find_reference (symtab_node referring_node, symtab_node referred_node, + gimple stmt) +{ + struct ipa_ref *r = NULL; + int i; + + FOR_EACH_VEC_SAFE_ELT (referring_node->symbol.ref_list.references, i, r) + if (r->referred == referred_node + && (in_lto_p || r->stmt == stmt)) + return r; + return NULL; +} |