]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[AutoFDO] Check count initialization to fix ICE with AutoFDO
authorKugan Vivekanandarajah <kvivekananda@nvidia.com>
Mon, 8 Sep 2025 09:10:44 +0000 (19:10 +1000)
committerKugan Vivekanandarajah <kvivekananda@nvidia.com>
Mon, 8 Sep 2025 10:37:48 +0000 (20:37 +1000)
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>
gcc/ipa-cp.cc

index 480cf48786c7a40760e52119bceb7e0e55750eee..4f2030a8d8cbfbc710b958527e095b56bf7b366c 100644 (file)
@@ -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;
 }