while working on auto-FDO I noticed that we may run into ICE because we inline
function with count profile_count::zero to a call site with profile_count::zero.
What may go wrong is that the caller has local profile while callee may have
IPA profiles.
We used to turn all such counts to 0, but that has changed by a short circuit
I introducd recently. Fixed thus.
* cgraph.cc (cgraph_node::apply_scale): Special case scaling
to profile_count::zero ().
(cgraph_node::verify_node): Add extra compatibility check.
void
cgraph_node::apply_scale (profile_count num, profile_count den)
{
- if (num == den)
+ if (num == den && !(num == profile_count::zero ()))
return;
for (cgraph_edge *e = callees; e; e = e->next_callee)
count.debug ();
error_found = true;
}
+ if (inlined_to && !e->count.compatible_p (inlined_to->count))
+ {
+ error ("edge count is not compatible with inlined to function count");
+ e->count.debug ();
+ count.debug ();
+ error_found = true;
+ }
if (!e->indirect_unknown_callee
|| !e->indirect_info)
{