> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c > index 64bdc92..c7a7c4d 100644 > --- a/gcc/tree-cfg.c > +++ b/gcc/tree-cfg.c > @@ -6177,6 +6177,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; > @@ -6268,6 +6269,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; You need to also set snew->count/sorig->count.
Also move_sese_region_to_fn seem to mis updating of counts. Can you, please, add that and send updated patch? Honza > > /* Register the new edge from SWITCH_BB in loop exit lists. */ > rescan_loop_exit (snew, true, false); > -- > 1.9.1 >