diff options
Diffstat (limited to 'gcc/ipa-fnsummary.cc')
-rw-r--r-- | gcc/ipa-fnsummary.cc | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/gcc/ipa-fnsummary.cc b/gcc/ipa-fnsummary.cc index dd41de9..e7b81d8 100644 --- a/gcc/ipa-fnsummary.cc +++ b/gcc/ipa-fnsummary.cc @@ -990,7 +990,10 @@ ipa_call_summary_t::duplicate (struct cgraph_edge *src, info->predicate = NULL; edge_set_predicate (dst, srcinfo->predicate); info->param = srcinfo->param.copy (); - if (!dst->indirect_unknown_callee && src->indirect_unknown_callee) + if (!dst->indirect_unknown_callee && src->indirect_unknown_callee + /* Don't subtract the size when dealing with callback pairs, since the + edge has no real size. */ + && !src->has_callback && !dst->callback) { info->call_stmt_size -= (eni_size_weights.indirect_call_cost - eni_size_weights.call_cost); @@ -2356,7 +2359,8 @@ param_change_prob (ipa_func_body_info *fbi, gimple *stmt, int i) /* Lookup the most frequent update of the value and believe that it dominates all the other; precise analysis here is difficult. */ EXECUTE_IF_SET_IN_BITMAP (info.bb_set, 0, index, bi) - max = max.max (BASIC_BLOCK_FOR_FN (cfun, index)->count); + max = profile_count::max_prefer_initialized + (max, BASIC_BLOCK_FOR_FN (cfun, index)->count); if (dump_file) { fprintf (dump_file, " Set with count "); @@ -3106,6 +3110,25 @@ analyze_function_body (struct cgraph_node *node, bool early) es, es3); } } + + /* If dealing with a carrying edge, copy its summary over to its + attached edges as well. */ + if (edge->has_callback) + { + cgraph_edge *cbe; + for (cbe = edge->first_callback_edge (); cbe; + cbe = cbe->next_callback_edge ()) + { + ipa_call_summary *es2 = ipa_call_summaries->get (cbe); + es2 = ipa_call_summaries->get_create (cbe); + ipa_call_summaries->duplicate (edge, cbe, es, es2); + /* Unlike speculative edges, callback edges have no real + size or time; the call doesn't exist. Reflect that in + their summaries. */ + es2->call_stmt_size = 0; + es2->call_stmt_time = 0; + } + } } /* TODO: When conditional jump or switch is known to be constant, but |