[RFC] update COUNTs of BB in loop.

Segher Boessenkool segher@kernel.crashing.org
Tue Sep 22 15:46:39 GMT 2020


Hi!

(Just some random things; the change itself looks fine afaics.)

On Tue, Sep 22, 2020 at 01:37:47PM +0800, guojiufu wrote:
> While after pcom:
> 
>                COUNT:268435456<bb 2>  pre-header
>                         |
>                         |  .--------------------.
>                         |  |                    |
>                         V  v                    |
>                COUNT:268435456<bb 3>            |
>                        / \                      |
>                    50%/   \                     |
>                      /     \                    |
>                     v       v                   |
> COUNT:134217728<bb 10>  COUNT:134217728<bb 15>  | 
>     exit-edge                 |   latch         |
>                               ._________________.
> 
> COUNT<bb 3> != COUNT<bb 2> + COUNT<bb 15>

And  COUNT<bb 10> != COUNT<bb2>  which does not make any sense.

> +/* Recacluate the COUNTs of BBs in LOOP, if the probility of exit edge
> +   is NEW_EXIT_P.  */

"Recalculate", "probability".  I would say "where the probability of the
single exit edge is NEW_EXIT_P".  But, _P means this is a predicate, and
it isn't (only function can be predicates, by definition).
"new_exit_prob" maybe?

> +  /* Update BB counts in loop body.
> +     COUNT<exit> = COUNT<pre-header>
> +     COUNT<exit> = COUNT<header> * exit_edge_probility
> +     The COUNT<new_header>=COUNT<old_header> * old_exit_p / new_exit_p.  */

Spaces around the "=" please?


Segher


More information about the Gcc-patches mailing list