This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] basic-block.h: Clean up FOR_EACH_EDGE.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]