diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2019-11-10 12:25:38 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2019-11-10 11:25:38 +0000 |
commit | 6cf67b62c8cda035dccaca2ae6ff94d560b37a6f (patch) | |
tree | 9a7cb2284e26f6d8f59e018c743ebdf3a8f7c3ce /gcc/ipa-cp.c | |
parent | 64166bf04b869e93570f8e728f4a71bb06d02ab8 (diff) | |
download | gcc-6cf67b62c8cda035dccaca2ae6ff94d560b37a6f.zip gcc-6cf67b62c8cda035dccaca2ae6ff94d560b37a6f.tar.gz gcc-6cf67b62c8cda035dccaca2ae6ff94d560b37a6f.tar.bz2 |
cgraph.h (struct cgraph_node): Add ipcp_clone flag.
* cgraph.h (struct cgraph_node): Add ipcp_clone flag.
(cgraph_node::create_virtual_clone): Copy it.
* ipa-cp.c (ipcp_versionable_function_p): Watch for missing
summaries.
(ignore_edge_p): If caller has ipa-cp disabled, skip the edge, too.
(ipcp_verify_propagated_values): Do not verify nodes where ipcp
is disabled.
(propagate_constants_across_call): If callee is not analyzed, give up.
(propagate_constants_topo): Lower to bottom latties of all callees of
functions with ipa-cp disabled.
(ipcp_propagate_stage): Skip functions with ipa-cp disabled.
(cgraph_edge_brings_value_p): Check for availability first.
(create_specialized_node): Set ipcp_clone.
(ipcp_store_bits_results): Check that info is present.
* ipa-fnsummary.c (evaluate_properties_for_edge): Do not analyze
thunks.
(ipa_call_context::duplicate_from, ipa_call_context::equal_to): Be
conservative when callee summary is missing.
(remap_edge_summaries): Lookup call summary only when needed.
* ipa-icf.c (sem_function::param_used_p): Be ready for missing summary.
* ipa-prpo.c (ipa_alloc_node_params, ipa_initialize_node_params):
Use get_create.
(ipa_analyze_node): Use get_create.
(propagate_controlled_uses): Do not propagate when function is not
analyzed.
(ipa_propagate_indirect_call_infos): Remove summary of inline clone.
(ipa_read_node_info): Use get_create.
* ipa-prop.h (IPA_NODE_REF): Use get.
(IPA_NODE_REF_GET_CREATE): New.
From-SVN: r278016
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r-- | gcc/ipa-cp.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index c6bd265..b1d8999 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -656,7 +656,7 @@ determine_versionability (struct cgraph_node *node, static bool ipcp_versionable_function_p (struct cgraph_node *node) { - return IPA_NODE_REF (node)->versionable; + return IPA_NODE_REF (node) && IPA_NODE_REF (node)->versionable; } /* Structure holding accumulated information about callers of a node. */ @@ -817,6 +817,7 @@ ignore_edge_p (cgraph_edge *e) = e->callee->function_or_virtual_thunk_symbol (&avail, e->caller); return (avail <= AVAIL_INTERPOSABLE + || !opt_for_fn (e->caller->decl, flag_ipa_cp) || !opt_for_fn (ultimate_target->decl, flag_ipa_cp)); } @@ -1471,6 +1472,8 @@ ipcp_verify_propagated_values (void) FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) { class ipa_node_params *info = IPA_NODE_REF (node); + if (!opt_for_fn (node->decl, flag_ipa_cp)) + continue; int i, count = ipa_get_param_count (info); for (i = 0; i < count; i++) @@ -2307,6 +2310,8 @@ propagate_constants_across_call (struct cgraph_edge *cs) return false; gcc_checking_assert (callee->has_gimple_body_p ()); callee_info = IPA_NODE_REF (callee); + if (!callee_info) + return false; args = IPA_EDGE_REF (cs); parms_count = ipa_get_param_count (callee_info); @@ -3233,7 +3238,17 @@ propagate_constants_topo (class ipa_topo_info *topo) until all lattices stabilize. */ FOR_EACH_VEC_ELT (cycle_nodes, j, v) if (v->has_gimple_body_p ()) - push_node_to_stack (topo, v); + { + if (opt_for_fn (v->decl, flag_ipa_cp)) + push_node_to_stack (topo, v); + /* When V is not optimized, we can not push it to stac, but + still we need to set all its callees lattices to bottom. */ + else + { + for (cgraph_edge *cs = v->callees; cs; cs = cs->next_callee) + propagate_constants_across_call (cs); + } + } v = pop_node_from_stack (topo); while (v) @@ -3254,7 +3269,8 @@ propagate_constants_topo (class ipa_topo_info *topo) the local effects of the discovered constants and all valid values to their topological sort. */ FOR_EACH_VEC_ELT (cycle_nodes, j, v) - if (v->has_gimple_body_p ()) + if (v->has_gimple_body_p () + && opt_for_fn (v->decl, flag_ipa_cp)) { struct cgraph_edge *cs; @@ -3333,11 +3349,10 @@ ipcp_propagate_stage (class ipa_topo_info *topo) FOR_EACH_DEFINED_FUNCTION (node) { - class ipa_node_params *info = IPA_NODE_REF (node); - - determine_versionability (node, info); - if (node->has_gimple_body_p ()) + if (node->has_gimple_body_p () && opt_for_fn (node->decl, flag_ipa_cp)) { + class ipa_node_params *info = IPA_NODE_REF (node); + determine_versionability (node, info); info->lattices = XCNEWVEC (class ipcp_param_lattices, ipa_get_param_count (info)); initialize_node_lattices (node); @@ -3526,8 +3541,8 @@ cgraph_edge_brings_value_p (cgraph_edge *cs, ipcp_value_source<tree> *src, enum availability availability; cgraph_node *real_dest = cs->callee->function_symbol (&availability); - if (!same_node_or_its_all_contexts_clone_p (real_dest, dest) - || availability <= AVAIL_INTERPOSABLE + if (availability <= AVAIL_INTERPOSABLE + || !same_node_or_its_all_contexts_clone_p (real_dest, dest) || caller_info->node_dead) return false; @@ -3583,9 +3598,11 @@ cgraph_edge_brings_value_p (cgraph_edge *cs, ipcp_value<ipa_polymorphic_call_context> *) { class ipa_node_params *caller_info = IPA_NODE_REF (cs->caller); - cgraph_node *real_dest = cs->callee->function_symbol (); + enum availability avail; + cgraph_node *real_dest = cs->callee->function_symbol (&avail); - if (!same_node_or_its_all_contexts_clone_p (real_dest, dest) + if (avail <= AVAIL_INTERPOSABLE + || !same_node_or_its_all_contexts_clone_p (real_dest, dest) || caller_info->node_dead) return false; if (!src->val) @@ -4018,6 +4035,7 @@ create_specialized_node (struct cgraph_node *node, update_profiling_info (node, new_node); new_info = IPA_NODE_REF (new_node); new_info->ipcp_orig_node = node; + new_node->ipcp_clone = true; new_info->known_csts = known_csts; new_info->known_contexts = known_contexts; @@ -5053,7 +5071,7 @@ ipcp_store_bits_results (void) bool dumped_sth = false; bool found_useful_result = false; - if (!opt_for_fn (node->decl, flag_ipa_bit_cp)) + if (!opt_for_fn (node->decl, flag_ipa_bit_cp) || !info) { if (dump_file) fprintf (dump_file, "Not considering %s for ipa bitwise propagation " |