This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] basic-block.h: Clean up FOR_EACH_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, 14 Mar 2005 09:48:45 -0700
- Subject: Re: [patch] basic-block.h: Clean up FOR_EACH_EDGE.
- Organization: Red Hat, Inc
- References: <20050311.205423.31650063.kazu@cs.umass.edu>
- Reply-to: law at redhat dot com
On Fri, 2005-03-11 at 20:54 -0500, Kazu Hirata wrote:
> Hi,
>
> Attached is a patch to clean up FOR_EACH_EDGE.
>
> After inlining, the terminating condition of the FOR_EACH_EDGE looks
> like so
>
> if (i == EDGE_COUNT (bb->succs))
> break;
> e = EDGE_SUCC (bb, i);
> if (e == NULL)
> break;
>
> Notice that we have two "if" statements. The first one is necessary,
> but the second one is not. We know that every edge in any edge vector
> is nonnull. This patch removes the null check.
>
> Unfortunately, this patch itself does not introduce a mesuarable
> speed-up, but this is a basis for a subsequent patch to simplify the
> first "if" statement above, which actually contains another "if"
> statement hidden in it.
>
> This patch does have a measurable size win of 0.099% on stripped
> versions of cc1.
>
> Tested on i686-pc-linux-gnu. OK to apply?
>
> Kazu Hirata
>
> 2005-03-12 Kazu Hirata <kazu@cs.umass.edu>
>
> * basic-block.h (ei_cond): New.
> (FOR_EACH_EDGE): Call ei_cond.
Basically OK. Though it seems to me ei_cond should really return a
bool rather than an int.
Jeff