This is the mail archive of the
mailing list for the GCC project.
Re: [patch] tree-cfg.c: Speed up cleanup_tree_cfg().
- From: Jeffrey A Law <law at redhat dot com>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 01 Oct 2004 14:11:18 -0600
- Subject: Re: [patch] tree-cfg.c: Speed up cleanup_tree_cfg().
- Organization: Red Hat, Inc
- References: <firstname.lastname@example.org>
- Reply-to: law at redhat dot com
On Fri, 2004-10-01 at 07:03, Kazu Hirata wrote:
> Attached is a patch to speed up cleanup_tree_cfg().
> Consider the loop in cleanup_tree_cfg().
> while (something_changed)
> something_changed = cleanup_control_flow ();
> something_changed |= delete_unreachable_blocks ();
> something_changed |= thread_jumps ();
> retval |= something_changed;
> Note that cleanup_control_flow() looks at the condition portion of
> each COND_EXPR and SWITCH_EXPR. Neither delete_unreachable_blocks()
> or thread_jumps() modifies the condition portion of any COND_EXPR or
> SWITCH_EXPR, so neither of them affects the result of
> cleanup_control_flow(). Therefore, we can pull it out of the loop.
> Here is the timing for 10 runs of "cc1 -O2 -o /dev/null fold-const.i".
> original patched patched*
> real: 183.800 183.358 (0.240% down) 182.447 (0.736% down)
> user: 181.106 180.796 (0.171% down) 179.965 (0.630% down)
> "patched*" is the patched GCC without the gcc_assert newly added in
> the patch.
> I am wondering if we actually need the gcc_assert(). I'll leave it up
> to you to decide whether we should keep it.
> Tested on i686-pc-linux-gnu. OK to apply?
> Kazu Hirata
> 2004-10-01 Kazu Hirata <email@example.com>
> * tree-cfg.c (cleanup_tree_cfg): Pull a call to
> cleanup_control_flow() out of the while loop.
Seems reasonable to me.