Hi, 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. Bootstrapped/regtested x86_64-linux, comitted. * cgraph.cc (cgraph_node::apply_scale): Special case scaling to profile_count::zero (). (cgraph_node::verify_node): Add extra compatibility check. diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 93353cbcb68..2441c9e866d 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -250,7 +250,7 @@ cgraph_node::make_profile_global0 (profile_quality quality) 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) @@ -3763,6 +3763,13 @@ cgraph_node::verify_node (void) 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) {