]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix ICE in afdo_adjust_guessed_profile
authorJan Hubicka <hubicka@ucw.cz>
Wed, 9 Jul 2025 16:30:09 +0000 (18:30 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Wed, 9 Jul 2025 16:30:50 +0000 (18:30 +0200)
gcc/ChangeLog:

* auto-profile.cc (afdo_adjust_guessed_profile): Add forgotten
if (dump_file) guard.

gcc/auto-profile.cc

index e27bcc7b58db993a558eb40f0d1f5b8711699c63..219676012e76fb3ef91bc9d8abf22cc6e4163e52 100644 (file)
@@ -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);