From: Kugan Vivekanandarajah Date: Mon, 8 Sep 2025 09:10:44 +0000 (+1000) Subject: [AutoFDO] Check count initialization to fix ICE with AutoFDO X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=80b453d5e4b423730033fd15bc26075347dfd5ba;p=thirdparty%2Fgcc.git [AutoFDO] Check count initialization to fix ICE with AutoFDO 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 * ipa-cp.cc (gather_count_of_non_rec_edges): Check count initialization before adding to total. Signed-off-by: Kugan Vivekanandarajah --- diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index 480cf48786c..4f2030a8d8c 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -4555,7 +4555,8 @@ gather_count_of_non_rec_edges (cgraph_node *node, void *data) 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; }