This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] predict.c: merge multi-edges

On 07/22/2016 05:38 AM, Martin Liška wrote:
On 07/22/2016 12:53 PM, Segher Boessenkool wrote:
Hi Martin,

On Fri, Jul 22, 2016 at 10:17:51AM +0200, Martin Liška wrote:
 /* We can not predict the probabilities of outgoing edges of bb.  Set them
-   evenly and hope for the best.  */
+   evenly and hope for the best.  If UNLIKELY_EDGES is not null, distribute
+   evel probability for all edges not mentioned in the set.  These edges
+   are given PROB_VERY_UNLIKELY probability.  */

Typo ("evel");

Hello Segher.

The typo is fixed.

+  unsigned unlikely_count = unlikely_edges ? unlikely_edges->elements () : 0;
   FOR_EACH_EDGE (e, ei, bb->succs)
     if (!(e->flags & (EDGE_EH | EDGE_FAKE)))
       nedges ++;
+  unsigned c = nedges - unlikely_count;

What prevents c from becoming 0?  The sum of outgoing edge probabilities
will be very small then (unless there are very many such noreturn edges,
then the sum is too big, instead).

You are right, I'm sending second version where I set even probabilities
in case of all edges are PROB_VERY_UNLIKELY. However, I was unable to come
up with a test-case for that:

int main(int argc, char **argv)
  switch (argc)
    case 1:
    case 4:

  return 10;

No predictors are set as 'has_return_edges' == false in tree_bb_level_predictions.
Can you turn this into a test as well?

With that change this patch is OK for the trunk.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]