aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-fnsummary.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-11-10 12:25:38 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-11-10 11:25:38 +0000
commit6cf67b62c8cda035dccaca2ae6ff94d560b37a6f (patch)
tree9a7cb2284e26f6d8f59e018c743ebdf3a8f7c3ce /gcc/ipa-fnsummary.c
parent64166bf04b869e93570f8e728f4a71bb06d02ab8 (diff)
downloadgcc-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-fnsummary.c')
-rw-r--r--gcc/ipa-fnsummary.c73
1 files changed, 39 insertions, 34 deletions
diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 7b81827..686d960 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -483,36 +483,39 @@ evaluate_properties_for_edge (struct cgraph_edge *e, bool inline_p,
if (count && known_contexts_ptr)
known_contexts_ptr->safe_grow_cleared (count);
- for (i = 0; i < count; i++)
- {
- struct ipa_jump_func *jf = ipa_get_ith_jump_func (args, i);
- tree cst = ipa_value_from_jfunc (caller_parms_info, jf,
- ipa_get_type (callee_pi, i));
-
- if (!cst && e->call_stmt
- && i < (int)gimple_call_num_args (e->call_stmt))
- {
- cst = gimple_call_arg (e->call_stmt, i);
- if (!is_gimple_min_invariant (cst))
- cst = NULL;
- }
- if (cst)
- {
- gcc_checking_assert (TREE_CODE (cst) != TREE_BINFO);
- if (known_vals.exists ())
- known_vals[i] = cst;
- }
- else if (inline_p && !es->param[i].change_prob)
- known_vals[i] = error_mark_node;
-
- if (known_contexts_ptr)
- (*known_contexts_ptr)[i]
- = ipa_context_from_jfunc (caller_parms_info, e, i, jf);
- /* TODO: When IPA-CP starts propagating and merging aggregate jump
- functions, use its knowledge of the caller too, just like the
- scalar case above. */
- known_aggs[i] = &jf->agg;
- }
+ if (callee_pi)
+ for (i = 0; i < count; i++)
+ {
+ struct ipa_jump_func *jf = ipa_get_ith_jump_func (args, i);
+ tree cst = ipa_value_from_jfunc (caller_parms_info, jf,
+ ipa_get_type (callee_pi, i));
+
+ if (!cst && e->call_stmt
+ && i < (int)gimple_call_num_args (e->call_stmt))
+ {
+ cst = gimple_call_arg (e->call_stmt, i);
+ if (!is_gimple_min_invariant (cst))
+ cst = NULL;
+ }
+ if (cst)
+ {
+ gcc_checking_assert (TREE_CODE (cst) != TREE_BINFO);
+ if (known_vals.exists ())
+ known_vals[i] = cst;
+ }
+ else if (inline_p && !es->param[i].change_prob)
+ known_vals[i] = error_mark_node;
+
+ if (known_contexts_ptr)
+ (*known_contexts_ptr)[i]
+ = ipa_context_from_jfunc (caller_parms_info, e, i, jf);
+ /* TODO: When IPA-CP starts propagating and merging aggregate jump
+ functions, use its knowledge of the caller too, just like the
+ scalar case above. */
+ known_aggs[i] = &jf->agg;
+ }
+ else
+ gcc_assert (callee->thunk.thunk_p);
}
else if (e->call_stmt && !e->call_stmt_cannot_inline_p
&& ((clause_ptr && info->conds) || known_vals_ptr))
@@ -3004,7 +3007,8 @@ ipa_call_context::duplicate_from (const ipa_call_context &ctx)
m_possible_truths = ctx.m_possible_truths;
m_nonspec_possible_truths = ctx.m_nonspec_possible_truths;
class ipa_node_params *params_summary = IPA_NODE_REF (m_node);
- unsigned int nargs = ipa_get_param_count (params_summary);
+ unsigned int nargs = params_summary
+ ? ipa_get_param_count (params_summary) : 0;
m_inline_param_summary = vNULL;
/* Copy the info only if there is at least one useful entry. */
@@ -3093,7 +3097,8 @@ ipa_call_context::equal_to (const ipa_call_context &ctx)
return false;
class ipa_node_params *params_summary = IPA_NODE_REF (m_node);
- unsigned int nargs = ipa_get_param_count (params_summary);
+ unsigned int nargs = params_summary
+ ? ipa_get_param_count (params_summary) : 0;
if (m_inline_param_summary.exists () || ctx.m_inline_param_summary.exists ())
{
@@ -3404,7 +3409,7 @@ inline_update_callee_summaries (struct cgraph_node *node, int depth)
}
/* Update change_prob of EDGE after INLINED_EDGE has been inlined.
- When functoin A is inlined in B and A calls C with parameter that
+ When function A is inlined in B and A calls C with parameter that
changes with probability PROB1 and C is known to be passthroug
of argument if B that change with probability PROB2, the probability
of change is now PROB1*PROB2. */
@@ -3472,12 +3477,12 @@ remap_edge_summaries (struct cgraph_edge *inlined_edge,
struct cgraph_edge *e, *next;
for (e = node->callees; e; e = next)
{
- class ipa_call_summary *es = ipa_call_summaries->get (e);
predicate p;
next = e->next_callee;
if (e->inline_failed)
{
+ class ipa_call_summary *es = ipa_call_summaries->get (e);
remap_edge_change_prob (inlined_edge, e);
if (es->predicate)