Fix ICE with AutoFDO by adding initialization check
before accessing IPA counts to avoid issues with uninitialized profile
counts in self-recursive clone processing.
gcc/ChangeLog:
2025-09-08 Kugan Vivekanandarajah <kvivekananda@nvidia.com>
* ipa-cp.cc (gather_count_of_non_rec_edges): Check count
initialization before adding to total.
Signed-off-by: Kugan Vivekanandarajah <kvivekananda@nvidia.com>
gather_other_count_struct *desc = (gather_other_count_struct *) data;
for (cgraph_edge *cs = node->callers; cs; cs = cs->next_caller)
if (cs->caller != desc->orig && cs->caller->clone_of != desc->orig)
- desc->other_count += cs->count.ipa ();
+ if (cs->count.ipa ().initialized_p ())
+ desc->other_count += cs->count.ipa ();
return false;
}