Speedup for tree-inline.c?

Steven Bosscher s.bosscher@student.tudelft.nl
Wed Apr 23 21:52:00 GMT 2003


Hi,

With the attached patch we should walk_tree a bit faster when looking
for alloca and longjmp calls.  There doesn't seem to be any reason to
walk the same tree multiple times when looking for alloca and longjmp,
and in calls_setjmp_p (in cp/optimize.c), we also use
walk_tree_without_duplicates.

(I would expect to see a speedup from this, but I haven't been able to
test that yet, only with checking enabled, but that's a cheat because we
do fewer tree checks...).  

Another thing that could maybe speedup walk_tree a bit is to add a new
argument that tells whether or not you want to walk type nodes.  Again,
there really seems to be no reason to walk type nodes when you're
looking for a function call in a tree. I was thinking of something like,

 tail_recurse:
  /* Skip empty subtrees.  */
  if (!*tp
      || (TREE_CODE_CLASS (*tp) == 't' && !walk_type_nodes))
    return NULL_TREE;

where walk_type_nodes would be the new function argument to walk_tree. 
Anyone know if it is necessary to always walk type nodes?

Anyway, this patch first.  Bootstrapped all except Ada on
i586-pc-linux-gnu, regtesting well under way.  OK for mainline if it
passes?

Greetz
Steven

2003-04-23  Steven Bosscher  <steven@gcc.gnu.org>

	* tree-inline.c (find_alloca_call_1): Use conditional expr.
	(find_alloca_call): Use walk_tree_without_duplicates.
	(find_builtin_longjmp_call): Likewise.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: tree-inline.diff
Type: text/x-patch
Size: 1791 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030423/8c4cf9ef/attachment.bin>


More information about the Gcc-patches mailing list