> 
> >
> > Please give Honza the chance to chime in.
> 
> Does that mean this is approved since Honza has not chimed in over 2 weeks?
> Just want to double check for pushing it.
Sorry for being late.  The patch makes sense to me
and thanks for looking into this.
I noticed is that in your original email:

>   <bb 4> [local count: 1073741824]:
>   # i_4 = PHI <0(2), i_11(3)>
>   t_8 = *l_7(D);
>   if (t_8 < 0)
>     goto <bb 5>; [0.04%]
>   else
>     goto <bb 6>; [99.96%]
>
>   <bb 5> [local count: 429496]:
>   __builtin_unreachable ();

The probability of edge bb4->bb5 is wrong to have non-zero probability.

With trunk I see it gets predicted by cold call heuristics:

Predictions for bb 2
  first match heuristics: 0.04%
  combined heuristics: 0.04%
  opcode values positive (on trees) heuristics of edge 2->3 (ignored): 41.00%
  cold function call heuristics of edge 2->3 (ignored): 0.04%
  noreturn call heuristics of edge 2->3: 0.04%

Predictions for bb 2
1 edges in bb 2 predicted to even probabilities
Predictions for bb 3
0 edges in bb 3 predicted to even probabilities
Predictions for bb 4
1 edges in bb 4 predicted to even probabilities
int size (int * a)
{
  int t;

  <bb 2> [local count: 1073741824]:
  t_3 = *a_2(D);
  if (t_3 < 0)
    goto <bb 3>; [0.00%]
  else
    goto <bb 4>; [100.00%]

  <bb 3> [count: 0]:
  __builtin_unreachable ();


While GCC 15 does:

Predictions for bb 2
1 edges in bb 2 predicted to even probabilities
Predictions for bb 3
0 edges in bb 3 predicted to even probabilities
Predictions for bb 4
1 edges in bb 4 predicted to even probabilities
int size (int * a)
{
  int t;

  <bb 2> [local count: 1073741824]:
  t_3 = *a_2(D);
  if (t_3 < 0)
    goto <bb 3>; [0.00%]
  else
    goto <bb 4>; [100.00%]

  <bb 3> [count: 0]:
  __builtin_unreachable ();

Here edge from bb2->bb3 is predicted with profile_probability::zero() as
part of backwards propagation from __builtin_unreachable and
consequently is not predicted later.  Need to work out why this changed.

Honza

Reply via email to