https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65511

--- Comment #1 from vries at gcc dot gnu.org ---
tentative patch:
...
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 0f5e428..837dbbd 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -6175,6 +6175,7 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED,
edge exit ATTRIBUTE_UNU
   gphi *phi;
   tree def;
   struct loop *target, *aloop, *cloop;
+  int exit_prob = exit->probability;

   gcc_assert (EDGE_COUNT (exit->src->succs) == 2);
   exits[0] = exit;
@@ -6266,6 +6267,8 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED,
edge exit ATTRIBUTE_UNU
   sorig = single_succ_edge (switch_bb);
   sorig->flags = exits[1]->flags;
   snew = make_edge (switch_bb, nentry_bb, exits[0]->flags);
+  snew->probability = exit_prob;
+  sorig->probability = REG_BR_PROB_BASE - exit_prob;

   /* Register the new edge from SWITCH_BB in loop exit lists.  */
   rescan_loop_exit (snew, true, false);
...

Reply via email to