vartracking speedup

Jakub Jelinek jakub@redhat.com
Thu Jun 3 11:24:00 GMT 2010


On Thu, Jun 03, 2010 at 01:11:09PM +0200, Richard Guenther wrote:
> > and the third one shouldn't have VALUE_RECURSED_INTO set and so should
> > continue as well.  Will fire off a bootstrap to verify this assumption.
> 
> A patch along that line is pre-approved if it works.

It works.  I've also gathered statistics, during x86_64 and i686 bootstraps
+ regtests together the loop saw
432341174 set->regs[i] == NULL
 73967338 set->regs[i]->next == NULL
  1230406 set->regs[i]->next != NULL

So the patch gets rid of 99.75% of memset calls in this function (on x86_64
that's currently 696 bytes long memset).  So it isn't worth improving the
code for 2+ long lists.

2010-06-03  Jan Hubicka  <jh@suse.cz>
	    Jakub Jelinek  <jakub@redhat.com>

	* var-tracking.c (dataflow_set_equiv_regs): Shortcut the loop if                                                                        
	set->regs[i] is NULL or has just one entry.

--- gcc/var-tracking.c.jj	2010-06-01 19:13:31.000000000 +0200
+++ gcc/var-tracking.c	2010-06-03 13:16:42.537411351 +0200
@@ -3694,6 +3694,11 @@ dataflow_set_equiv_regs (dataflow_set *s
     {
       rtx canon[NUM_MACHINE_MODES];
 
+      /* If the list is empty or one entry, no need to canonicalize
+	 anything.  */
+      if (set->regs[i] == NULL || set->regs[i]->next == NULL)
+	continue;
+
       memset (canon, 0, sizeof (canon));
 
       for (list = set->regs[i]; list; list = list->next)


	Jakub



More information about the Gcc-patches mailing list