> Hi Honza,
> 
> My current patch set for AArch64 VLA omp codegen started failing on
> gcc.dg/gomp/pr87898.c after this. I traced it back to
> 'move_sese_region_to_fn' in tree/cfg.cc not setting count for the bb
> created.
> 
> I was able to 'fix' it locally by setting the count of the new bb to the
> accumulation of e->count () of all the entry_endges (if initialized). I'm
> however not even close to certain that's the right approach, attached patch
> for illustration.
> 
> Kind regards,
> Andre
> diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc

> index 
> ffab7518b1568b58e610e26feb9e3cab18ddb3c2..32fc47ae683164bf8fac477fbe6e2c998382e754
>  100644
> --- a/gcc/tree-cfg.cc
> +++ b/gcc/tree-cfg.cc
> @@ -8160,11 +8160,15 @@ move_sese_region_to_fn (struct function *dest_cfun, 
> basic_block entry_bb,
>    bb = create_empty_bb (entry_pred[0]);
>    if (current_loops)
>      add_bb_to_loop (bb, loop);
> +  profile_count count = profile_count::zero ();
>    for (i = 0; i < num_entry_edges; i++)
>      {
>        e = make_edge (entry_pred[i], bb, entry_flag[i]);
>        e->probability = entry_prob[i];
> +      if (e->count ().initialized_p ())
> +     count += e->count ();
>      }
> +  bb->count = count;

This looks generally right - if you create a BB you need to set its
count and unless it has self-loop that is the sum of counts of
incommping edges.

However the initialized_p check should be unnecessary: if one of entry
edges to BB is uninitialized, the + operation will make bb count
uninitialized too, which is OK.

Honza
>  
>    for (i = 0; i < num_exit_edges; i++)
>      {

Reply via email to