This is the mail archive of the
mailing list for the GCC project.
Re: [patch] cfgrtl.c: Speed up rtl_tidy_fallthru_edge.
- 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: Mon, 29 Nov 2004 10:29:02 -0700
- Subject: Re: [patch] cfgrtl.c: Speed up rtl_tidy_fallthru_edge.
- Organization: Red Hat, Inc
- References: <email@example.com>
- Reply-to: law at redhat dot com
On Sat, 2004-11-27 at 21:37 -0500, Kazu Hirata wrote:
> Attached is a patch to speed up rtl_tidy_fallthru_edge.
> In rtl_tidy_fallthru_edge, the only result we use out of the
> FOR_EACH_EDGE loop is ei.index.
> Now, consider a part of the condition in the "if" statement shown in
> the patch.
> EDGE_SUCC (b, 0) == e && ei.index == EDGE_COUNT (b->succs) - 1
> Since ei.index is the index of edge E within B->succs, the second half
> of the condition tests whether the last edge in the edge vector is
> equal to E, which we can express as
> EDGE_SUCC (b, 0) == e && EDGE_SUCC (b, EDGE_COUNT (b->succs) - 1) == e
> Since edges in any edge vector are unique, the condition above is true
> if and only if
> EDGE_COUNT (b->succs) == 1 && EDGE_SUCC (b, 0) == e
> But then E is known to be one of the successor edges of B. In fact, B
> is computed as E->src. Therefore, we can remove the second half and
> EDGE_COUNT (b->succs) == 1
> Tested on i686-pc-linux-gnu. OK to apply?
> Kazu Hirata
> 2004-11-28 Kazu Hirata <firstname.lastname@example.org>
> * cfgrtl.c (rtl_tidy_fallthru_edge): Speed up by using