https://gcc.gnu.org/g:18324422fdd790b0c11ba300a706a86df1023b74

commit r16-2150-g18324422fdd790b0c11ba300a706a86df1023b74
Author: Jan Hubicka <hubi...@ucw.cz>
Date:   Wed Jul 9 18:30:09 2025 +0200

    Fix ICE in afdo_adjust_guessed_profile
    
    gcc/ChangeLog:
    
            * auto-profile.cc (afdo_adjust_guessed_profile): Add forgotten
            if (dump_file) guard.

Diff:
---
 gcc/auto-profile.cc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index e27bcc7b58db..219676012e76 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -3613,9 +3613,13 @@ afdo_adjust_guessed_profile (bb_set *annotated_bb)
          of hot basic blocks.  */
        if (max_count * scale > max_count_in_fn.guessed_local ())
         {
-          fprintf (dump_file, "Scaling by %.16f produces max count ", 
scale.to_double ());
-          (max_count * scale).dump (dump_file);
-          fprintf (dump_file, " that exceeds max count in fn; capping\n");
+          if (dump_file)
+            {
+              fprintf (dump_file, "Scaling by %.16f produces max count ",
+                       scale.to_double ());
+              (max_count * scale).dump (dump_file);
+              fprintf (dump_file, " that exceeds max count in fn; capping\n");
+            }
           scale = max_count_in_fn.guessed_local ().to_sreal_scale (max_count);
         }
        scale_bbs (bbs, scale);

Reply via email to