https://gcc.gnu.org/g:cfb04e0de6aa438df9d8b83a3d8c7f93789b5c9f

commit r16-116-gcfb04e0de6aa438df9d8b83a3d8c7f93789b5c9f
Author: Jan Hubicka <hubi...@ucw.cz>
Date:   Thu Apr 24 18:35:54 2025 +0200

    Fix ICE building deepsjeng with -fprofile-use
    
    The problem here is division by zero, since adjusted 0 > precise 0. Fixed by
    using right test.
    
    gcc/ChangeLog:
    
            PR ipa/119924
            * ipa-cp.cc (update_counts_for_self_gen_clones): Use nonzero_p.
            (update_profiling_info): Likewise.
            (update_specialized_profile): Likewise.

Diff:
---
 gcc/ipa-cp.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index abde64b6f296..b4b96997d750 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -4639,7 +4639,7 @@ update_counts_for_self_gen_clones (cgraph_node *orig_node,
                                   const vec<cgraph_node *> &self_gen_clones)
 {
   profile_count redist_sum = orig_node->count.ipa ();
-  if (!(redist_sum > profile_count::zero ()))
+  if (!redist_sum.nonzero_p ())
     return;
 
   if (dump_file)
@@ -4710,7 +4710,7 @@ update_counts_for_self_gen_clones (cgraph_node *orig_node,
      it.  */
   for (cgraph_node *n : self_gen_clones)
     {
-      if (!(n->count.ipa () > profile_count::zero ()))
+      if (!n->count.ipa ().nonzero_p ())
        continue;
 
       desc_incoming_count_struct desc;
@@ -4756,7 +4756,7 @@ update_profiling_info (struct cgraph_node *orig_node,
   profile_count new_sum;
   profile_count remainder, orig_node_count = orig_node->count.ipa ();
 
-  if (!(orig_node_count > profile_count::zero ()))
+  if (!orig_node_count.nonzero_p ())
     return;
 
   if (dump_file)
@@ -4920,7 +4920,7 @@ update_specialized_profile (struct cgraph_node *new_node,
       orig_node_count.dump (dump_file);
       fprintf (dump_file, "\n");
     }
-  if (!(orig_node_count > profile_count::zero ()))
+  if (!orig_node_count.nonzero_p ())
     return;
 
   new_node_count = new_node->count;

Reply via email to