> > > >> > >> > + > >> > + default_edge->count = default_count; > >> > + if (count) > >> > + { > >> > + edge e; > >> > + edge_iterator ei; > >> > + FOR_EACH_EDGE (e, ei, stmt_bb->succs) > >> > + e->probability = e->count * REG_BR_PROB_BASE / count; > >> > + } > >> > >> Hmm, this updates origina BB containing the switch statement? > > The out_edges of the original BB. > >> Of course, > >> modulo roundoff errors, this should hold. I wonder where did you got the > >> diferences and why do you need this? > > The count of the outgoing edge of BB that jumps to the default label > needs to be updated (to 0 or original_default_count/2, depending on > whether default label is a jump table target). So I need to > redistribute the probabilities of the rest of the edges. That's why I > do this here.
Hmm, I see, OK then. Please add a comment. Honza > > > Originally, I obtained e->probability as e->count * REG_BR_PROB_BASE / > > bb->count. During profile bootstrap, I noticed BBs whose sum of > > outgoing edge counts exceeded the BB's count and hence I normalized > > with the sum of edge counts. > > > >> You are going to output new control flow > >> and find_many_sub_basic_blocks will recompute all the counts/frequencies > >> inside > >> anyway? > > Sorry, I am lost here. I am just updating the probability of > > stmt_bb->succs right? > > > >