branch probabilities on multiway branches

Rahul Kharche rahul@IceraSemi.com
Tue Apr 13 16:51:00 GMT 2010


Hi All,

The following bit of code in predict.c implies branch probabilities
are strictly evenly distributed for multiway branches at present. The
comment suggests it is possible to generate better estimates for more
generic cases, apart from being involved. Could anyone point me to
the reference and/or if an implementation exists already.


/* When there is no successor or only one choice, prediction is easy. 

   We are lazy for now and predict only basic blocks with two outgoing
   edges.  It is possible to predict generic case too, but we have to
   ignore first match heuristics and do more involved combining.
Implement
   this later.  */
if (nedges != 2)
  {
    if (!bb->count)
      set_even_probabilities (bb);
    clear_bb_predictions (bb);
    if (dump_file)
      fprintf (dump_file, "%i edges in bb %i predicted to even
probabilities\n",
	       nedges, bb->index);
    return;
  }


Many Thanks,
Rahul



More information about the Gcc mailing list