diff mbox series

Fix branch prediction dump message (was: Predict loops containing recursive call with fewer iterations)

Message ID 87o753y9os.fsf@euler.schwinge.ddns.net
State New
Headers show
Series Fix branch prediction dump message (was: Predict loops containing recursive call with fewer iterations) | expand

Commit Message

Thomas Schwinge Sept. 4, 2024, 10:50 a.m. UTC
Hi!

On 2016-06-26T21:36:56+0200, Jan Hubicka <hubicka@ucw.cz> wrote:
> this patch [...]

> --- predict.c	(revision 237789)
> +++ predict.c	(working copy)

> @@ -3367,6 +3446,15 @@ pass_profile::execute (function *fun)
>      gimple_dump_cfg (dump_file, dump_flags);
>   if (profile_status_for_fn (fun) == PROFILE_ABSENT)
>      profile_status_for_fn (fun) = PROFILE_GUESSED;
> + if (dump_file && (dump_flags & TDF_DETAILS))
> +   {
> +     struct loop *loop;
> +     FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
> +       if (loop->header->frequency)
> +         fprintf (dump_file, "Loop got predicted %d to iterate %i times.\n",
> +       	   loop->num,
> +       	   (int)expected_loop_iterations_unbounded (loop));
> +   }
>    return 0;
>  }

... has some in a strange order terms.  ;-) Long ago, Frederik has fixed
this (unfortunately only) on a development branch.  As obvious, I've now
pushed to trunk branch commit 35e4414bac06927387fb7a6fe10b373e766da1c1
"Fix branch prediction dump message", see attached.


Grüße
 Thomas
diff mbox series

Patch

From 35e4414bac06927387fb7a6fe10b373e766da1c1 Mon Sep 17 00:00:00 2001
From: Frederik Harwath <frederik@codesourcery.com>
Date: Tue, 16 Nov 2021 16:13:51 +0100
Subject: [PATCH] Fix branch prediction dump message

Instead of, for instance, "Loop got predicted 1 to iterate 10 times"
the message should be "Loop 1 got predicted to iterate 10 times".

gcc/ChangeLog:

	* predict.cc (pass_profile::execute): Fix dump message.

Co-authored-by: Thomas Schwinge <tschwinge@baylibre.com>
---
 gcc/predict.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/predict.cc b/gcc/predict.cc
index 43e3694cb42..f611161f4aa 100644
--- a/gcc/predict.cc
+++ b/gcc/predict.cc
@@ -4210,7 +4210,7 @@  pass_profile::execute (function *fun)
      sreal iterations;
      for (auto loop : loops_list (cfun, LI_FROM_INNERMOST))
        if (expected_loop_iterations_by_profile (loop, &iterations))
-	 fprintf (dump_file, "Loop got predicted %d to iterate %f times.\n",
+	 fprintf (dump_file, "Loop %d got predicted to iterate %f times.\n",
 	   loop->num, iterations.to_double ());
    }
   return 0;
-- 
2.34.1