Fix reload failure

Jan Hubicka jh@suse.cz
Wed Jun 12 13:30:00 GMT 2002


Hi,
my previous patch to find_valid_class contained thinko that caused it to choose
large, but expensive class in case it appear first.  Because of that some of
the testcases still fails, specifically we can't build SPEC2000 gcc with
-march=athlon-xp -msse2 -mfpmath=sse -O2.

The attached patch fixes the think. OK for mainline/branch?
Bootstrapped regtested i386/branch.

Honza

Wed Jun 12 22:28:34 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* reload.c (find_valid_class)
Index: reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.178.2.3
diff -c -3 -p -r1.178.2.3 reload.c
*** reload.c	27 May 2002 08:40:43 -0000	1.178.2.3
--- reload.c	12 Jun 2002 20:28:30 -0000
*************** find_valid_class (m1, n, dest_regno)
*** 677,682 ****
--- 677,683 ----
    enum reg_class best_class = NO_REGS;
    enum reg_class dest_class = REGNO_REG_CLASS (dest_regno);
    unsigned int best_size = 0;
+   int cost;
  
    for (class = 1; class < N_REG_CLASSES; class++)
      {
*************** find_valid_class (m1, n, dest_regno)
*** 687,695 ****
  	    && ! HARD_REGNO_MODE_OK (regno + n, m1))
  	  bad = 1;
  
!       if (! bad && reg_class_size[class] > best_size
! 	  && (best_cost < 0
! 	      || best_cost >= REGISTER_MOVE_COST (m1, class, dest_class)))
  	{
  	  best_class = class;
  	  best_size = reg_class_size[class];
--- 688,701 ----
  	    && ! HARD_REGNO_MODE_OK (regno + n, m1))
  	  bad = 1;
  
!       if (bad)
! 	continue;
!       cost = REGISTER_MOVE_COST (m1, class, dest_class);
! 
!       if (! bad
! 	  && ((reg_class_size[class] > best_size
! 	       && (best_cost < 0 || best_cost >= cost))
! 	      || best_cost > cost))
  	{
  	  best_class = class;
  	  best_size = reg_class_size[class];



More information about the Gcc-patches mailing list