public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2384] Simplify force_edge_cold.
@ 2023-07-07 17:21 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2023-07-07 17:21 UTC (permalink / raw)
  To: gcc-cvs

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

commit r14-2384-gbb3b9c1c3ba8228387ea8a94f3638190d1696324
Author: Jan Hubicka <jh@suse.cz>
Date:   Fri Jul 7 19:21:02 2023 +0200

    Simplify force_edge_cold.
    
    gcc/ChangeLog:
    
            * predict.cc (force_edge_cold): Use
            set_edge_probability_and_rescale_others; improve dumps.

Diff:
---
 gcc/predict.cc | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/gcc/predict.cc b/gcc/predict.cc
index d65c26f0ab2..1aa4c25eb70 100644
--- a/gcc/predict.cc
+++ b/gcc/predict.cc
@@ -4421,21 +4421,16 @@ force_edge_cold (edge e, bool impossible)
      there.  */
   else if (prob_sum > profile_probability::never ())
     {
-      if (!(e->probability < goal))
-	e->probability = goal;
-
-      profile_probability prob_comp = prob_sum / e->probability.invert ();
-
       if (dump_file && (dump_flags & TDF_DETAILS))
-	fprintf (dump_file, "Making edge %i->%i %s by redistributing "
-		 "probability to other edges.\n",
-		 e->src->index, e->dest->index,
-		 impossible ? "impossible" : "cold");
-      FOR_EACH_EDGE (e2, ei, e->src->succs)
-	if (e2 != e)
-	  {
-	    e2->probability /= prob_comp;
-	  }
+	{
+	  fprintf (dump_file, "Making edge %i->%i %s by redistributing "
+		   "probability to other edges. Original probability: ",
+		   e->src->index, e->dest->index,
+		   impossible ? "impossible" : "cold");
+	  e->probability.dump (dump_file);
+	  fprintf (dump_file, "\n");
+	}
+      set_edge_probability_and_rescale_others (e, goal);
       if (current_ir_type () != IR_GIMPLE
 	  && e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun))
 	update_br_prob_note (e->src);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-07 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-07 17:21 [gcc r14-2384] Simplify force_edge_cold Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).