This is the mail archive of the gcc@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]

Re: big slowdown in egcs-1.1.2->gcc-2.95 on alpha


> The biggest time sink seems to be the quadratic algorithm in prune_preferences
> in global.c.

Hmm, I wonder if the CONFLICT_P tests take a lot of time, or if the rest
of the operations in the inner loop cost more.

I wonder if this works:

Thu Aug  5 22:27:15 1999  J"orn Rennecke <amylaar@cygnus.co.uk>

	* global.c (prune_preferences): Move some invariants out of the
	inner loop.

*** global.c	Wed Aug  4 21:33:01 1999
--- global.c-patched	Sat Aug  7 02:32:20 1999
*************** prune_preferences ()
*** 863,869 ****
  
    for (i = max_allocno - 1; i >= 0; i--)
      {
!       HARD_REG_SET temp;
  
        allocno = allocno_order[i];
        COPY_HARD_REG_SET (temp, hard_reg_conflicts[allocno]);
--- 863,869 ----
  
    for (i = max_allocno - 1; i >= 0; i--)
      {
!       HARD_REG_SET temp, temp2;
  
        allocno = allocno_order[i];
        COPY_HARD_REG_SET (temp, hard_reg_conflicts[allocno]);
*************** prune_preferences ()
*** 881,905 ****
        AND_COMPL_HARD_REG_SET (hard_reg_copy_preferences[allocno], temp);
        AND_COMPL_HARD_REG_SET (hard_reg_full_preferences[allocno], temp);
  
-       CLEAR_HARD_REG_SET (regs_someone_prefers[allocno]);
- 
        /* Merge in the preferences of lower-priority registers (they have
  	 already been pruned).  If we also prefer some of those registers,
  	 don't exclude them unless we are of a smaller size (in which case
  	 we want to give the lower-priority allocno the first chance for
  	 these registers).  */
        for (j = i + 1; j < max_allocno; j++)
  	if (CONFLICTP (allocno, allocno_order[j])
  	    || CONFLICTP (allocno_order[j], allocno))
  	  {
- 	    COPY_HARD_REG_SET (temp,
- 			       hard_reg_full_preferences[allocno_order[j]]);
  	    if (allocno_size[allocno_order[j]] <= allocno_size[allocno])
! 	      AND_COMPL_HARD_REG_SET (temp,
! 				      hard_reg_full_preferences[allocno]);
! 			       
! 	    IOR_HARD_REG_SET (regs_someone_prefers[allocno], temp);
  	  }
      }
  }
  
--- 881,907 ----
        AND_COMPL_HARD_REG_SET (hard_reg_copy_preferences[allocno], temp);
        AND_COMPL_HARD_REG_SET (hard_reg_full_preferences[allocno], temp);
  
        /* Merge in the preferences of lower-priority registers (they have
  	 already been pruned).  If we also prefer some of those registers,
  	 don't exclude them unless we are of a smaller size (in which case
  	 we want to give the lower-priority allocno the first chance for
  	 these registers).  */
+       CLEAR_HARD_REG_SET (temp);
+       CLEAR_HARD_REG_SET (temp2);
        for (j = i + 1; j < max_allocno; j++)
  	if (CONFLICTP (allocno, allocno_order[j])
  	    || CONFLICTP (allocno_order[j], allocno))
  	  {
  	    if (allocno_size[allocno_order[j]] <= allocno_size[allocno])
! 	      IOR_HARD_REG_SET (temp,
! 				hard_reg_full_preferences[allocno_order[j]]);
! 	    else
! 	      IOR_HARD_REG_SET (temp2,
! 				hard_reg_full_preferences[allocno_order[j]]);
  	  }
+       AND_COMPL_HARD_REG_SET (temp, hard_reg_full_preferences[allocno]);
+       IOR_HARD_REG_SET (temp, temp2);
+       COPY_HARD_REG_SET (regs_someone_prefers[allocno], temp);
      }
  }
  

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