+2017-11-17 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-cp.c (update_profiling_info): Handle conversion to local
+ profile.
+ * tree-cfg.c (execute_fixup_cfg): Do fixup same way as inliner does.
+
2017-11-17 Jeff Law <law@redhat.com>
* gimple-ssa-evrp.c (class evrp_range_analyzer): New class extracted
}
}
- new_node->count = new_sum;
- remainder = orig_node_count - new_sum;
+ if (!new_sum.nonzero_p ())
+ {
+ new_sum = new_sum.global0 ();
+ new_node->count = new_sum;
+ remainder = orig_node->count;
+ }
+ else
+ {
+ remainder = orig_node_count - new_sum;
+ if (!remainder.nonzero_p ())
+ remainder = orig_node_count.global0 ();
+ }
orig_node->count = remainder;
for (cs = new_node->callees; cs; cs = cs->next_callee)
- /* FIXME: why we care about non-zero frequency here? */
- if (cs->frequency ())
- cs->count = cs->count.apply_scale (new_sum, orig_node_count);
- else
- cs->count = profile_count::zero ();
+ cs->count = cs->count.apply_scale (new_sum, orig_node_count);
for (cs = orig_node->callees; cs; cs = cs->next_callee)
cs->count = cs->count.apply_scale (remainder, orig_node_count);
gimple_stmt_iterator gsi;
int todo = 0;
cgraph_node *node = cgraph_node::get (current_function_decl);
- profile_count num = node->count.ipa ();
+ profile_count num = node->count;
profile_count den = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;
- bool scale = num.initialized_p () && den.ipa_p ()
- && (den.nonzero_p () || num == profile_count::zero ())
- && !(num == den.ipa ());
+ bool scale = num.initialized_p () && !(num == den);
if (scale)
{
+ profile_count::adjust_for_ipa_scaling (&num, &den);
ENTRY_BLOCK_PTR_FOR_FN (cfun)->count = node->count;
EXIT_BLOCK_PTR_FOR_FN (cfun)->count
= EXIT_BLOCK_PTR_FOR_FN (cfun)->count.apply_scale (num, den);
FOR_EACH_BB_FN (bb, cfun)
{
if (scale)
- {
- if (num == profile_count::zero ())
- {
- if (!(bb->count == profile_count::zero ()))
- bb->count = bb->count.global0 ();
- }
- else
- bb->count = bb->count.apply_scale (num, den);
- }
+ bb->count = bb->count.apply_scale (num, den);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
gimple *stmt = gsi_stmt (gsi);