This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Speed up cleanup_tree_cfg() - Part 3
- 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: Tue, 05 Oct 2004 12:21:15 -0600
- Subject: Re: [patch] Speed up cleanup_tree_cfg() - Part 3
- Organization: Red Hat, Inc
- References: <email@example.com>
- Reply-to: law at redhat dot com
On Sun, 2004-10-03 at 07:05, Kazu Hirata wrote:
> Attached is a patch to further speed up cleanup_tree_cfg().
> It turns out that with a minor tweak to thread_jumps(), we can
> establish a property that it never leaves unreachable blocks provided
> that it starts out with no unreachable blocks. It's actually easy to
> do so. Without the patch, thread_jumps() removes unreachable blocks
> only when the dominator info is valid. All we have to do is to have
> it always remove unreachable blocks as they appear as a result of jump
> The new property in turn allows us to dramatically simplify the while
> loop in cleanup_tree_cfg() because thread_jumps() no longer leaves
> unreachable blocks.
> Here is the timing for 10 runs of "cc1 -O2 -o /dev/null fold-const.i".
> original patched
> real: 183.359 183.034 (0.177% down)
> user: 180.814 180.809 (0.002% down)
> ctc: 869 869
> ccf: 1152 1152
> dub: 1397 1152 (17.537% down)
> tj: 1114 1114
> ctc: the number of calls to cleanup_tree_cfg
> ccf: the number of calls to cleanup_control_flow from ctc
> dub: the number of calls to delete_unreachable_blocks from ctc
> tj: the number of calls to thread_jumps from ctc
> Note that we have "gcc_assert (!delete_unreachable_blocks())"
> immediately after the while loop, so when I tested my patch, the
> gcc_assert acted as an evidence (but not a proof) that thread_jumps()
> never leaves unreachable blocks.
> I tested the attached patch on top of
> Tested on i686-pc-linux-gnu. OK to apply?
> Admittedly, this speed up is very small, but my next patch will remove
> the while loop and will bring a bigger speed up, so stay tuned.
> Kazu Hirata
> 2004-10-03 Kazu Hirata <firstname.lastname@example.org>
> * tree-cfg.c (cleanup_tree_cfg): Don't call
> delete_unreachable_blosk() after thread_jumps().
> (thread_jumps): Always remove basic blocks as they become
This is fine.