Statistics finalization tweek

Richard Guenther richard.guenther@gmail.com
Tue Jun 22 12:36:00 GMT 2010


On Tue, Jun 22, 2010 at 2:01 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> looking into callgrind, one of most common callers of htab_traverse turns out to be
> statistics (even when it is disabled).
> This is because we call statistics_fini_pass for every function after every IPA pass
> rather than just once that I think should be sufficient ;)

Indeed.

> I wonder why we need to walk the table all the time?

It should be empty.  You could add a special non-allocating
variant of curr_statistics_hash () and avoid the traversal if it
is not allocated.

> Bootstrapped/regtested x86_64-linux, OK?

Ok.

Thanks,
Richard.

> Honza
>        * passes.c (execute_function_todo): Move call of statistics_fini_pass
>        to ...
>        (execute_todo) ... this one.
> Index: passes.c
> ===================================================================
> --- passes.c    (revision 160988)
> +++ passes.c    (working copy)
> @@ -1175,8 +1175,6 @@ execute_function_todo (void *data)
>   if (!flags)
>     return;
>
> -  statistics_fini_pass ();
> -
>   /* Always cleanup the CFG before trying to update SSA.  */
>   if (flags & TODO_cleanup_cfg)
>     {
> @@ -1288,6 +1286,8 @@ execute_todo (unsigned int flags)
>   /* Inform the pass whether it is the first time it is run.  */
>   first_pass_instance = (flags & TODO_mark_first_instance) != 0;
>
> +  statistics_fini_pass ();
> +
>   do_per_function (execute_function_todo, (void *)(size_t) flags);
>
>   /* Always remove functions just as before inlining: IPA passes might be
>



More information about the Gcc-patches mailing list