DCE speedup

Richard Guenther richard.guenther@gmail.com
Mon Jan 15 09:58:00 GMT 2007


On 1/15/07, Jan Hubicka <jh@suse.cz> wrote:
> Hi,
> with early inlining we are feeding SSA optimizers with very many small
> functions that often don't have room for optimization.
> It seem quite wasteful to follow each of pass by cleanup passes that walks
> INSN chain multiple times, so I would like to update the passes run early
> to return TODO flags conditionally.
> This patch updates DCE, if it seems sane, I will continue.
> The patch itself has little effect on compile time (it seems to be in between
> 1-3s on tramp3d), but it is still resonable thing to do IMO.
> It is also possible that we now have hidden dependencies in between passes
> so the noise introduced by earlier passes is cleaned up by DCE TODOs, but I
> think we should gradually identify it and add TODOs where they belong.
>
> The patch was bootstrapped/regtested i686-linux, OK?
> :ADDPATCH tree-optimization:

Ok with the following correction:

> 2007-01-15  Jan Hubicka  <jh@suse.cz>
>         * tree-ssa-dce.c (DCE_TODOs): New.
>         (propagate_necessity): Return if something changed.
>         (eliminate_unnecessary_stmts): Likewise.
>         (perform_tree_ssa_dce): Return TODO flags when needed.
>         (pass_dce, pass_dce_loop, pass_cd_dce): Remove TODO flags.


> + /* What to do when we cleaned up some statements.  */
> + #define DCE_TODOs (TODO_update_ssa | TODO_cleanup_cfg | TODO_ggc_collect \
> +                  | TODO_remove_unused_locals)

I don't like this - you only have one user here:

> --- 831,863 ----
>     tree_dce_done (aggressive);
>
>     free_edge_list (el);
> +   return something_changed ? DCE_TODOs : 0;
>   }

Just write it as
  if (something_changed)
    return ...;

  return 0;

Thanks,
Richard.



More information about the Gcc-patches mailing list