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] tree-cfg.c: Speed up tree_forwarder_block_p.


On Mon, 2005-01-10 at 23:58 -0500, Kazu Hirata wrote:
> Hi,
> 
> Attached is a patch to speed up tree_forwarder_block_p by scanning
> through the statements backwards (as suggested by Jeff).
> 
> One of the requirements of a forwarder block is that a basic block
> have statements except local labels.  Without this patch,
> tree_forwarder_block_p scans the statements forward, so the first
> statement that we encounter is almost always a label, which does not
> quite tell if a given basic block is a forwarder block or not.  With
> this patch, it scans the statements backward, so if there is any
> non-label statement, we can find that out in the first iteration.
> 
> With this patch, cleanup_forwarder_blocks fairly consistently takes
> 21ms instead of 24ms without the patch while compiling fold-const.c.
> So this is a micro optimization, but its effect is certainly
> measurable.
> 
> Tested on i686-pc-linux-gnu.  OK to apply?
> 
> Kazu Hirata
> 
> 2005-01-10  Kazu Hirata  <kazu@cs.umass.edu>
> 
> 	* tree-cfg.c (tree_forwarder_block_p): Speed up by walking
> 	through the statements backward.
Approved.

Jeff




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