]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Simplify force_edge_cold.
authorJan Hubicka <jh@suse.cz>
Fri, 7 Jul 2023 17:21:02 +0000 (19:21 +0200)
committerJan Hubicka <jh@suse.cz>
Fri, 7 Jul 2023 17:21:02 +0000 (19:21 +0200)
gcc/ChangeLog:

* predict.cc (force_edge_cold): Use
set_edge_probability_and_rescale_others; improve dumps.

gcc/predict.cc

index d65c26f0ab2a0f5b6a196a3874b77e0e8c3a5125..1aa4c25eb70a274ce856c8b79fdfcca2be4da82b 100644 (file)
@@ -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);