Patchwork Statistics finalization tweek

login
register
mail settings
Submitter Jan Hubicka
Date June 22, 2010, 12:01 p.m.
Message ID <20100622120130.GB4034@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/56464/
State New
Headers show

Comments

Jan Hubicka - June 22, 2010, 12:01 p.m.
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 ;)

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

Bootstrapped/regtested x86_64-linux, OK?

Honza
	* passes.c (execute_function_todo): Move call of statistics_fini_pass
	to ...
	(execute_todo) ... this one.
Richard Guenther - June 22, 2010, 12:10 p.m.
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
>

Patch

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