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]

[3.2, mainline] fix crash when compiling sixtrack on x86-64


Hi,
this patch fixes crash of GCC when compiling sixtrack on x86-64 with
-funroll-all-loops.  Problem is that find_splittable_givs assumes on several
places new_reg to be REG for DEST_REG givs, but it may be subreg.

Regtested/bootstrapped 3.2 release and testing of mainline in progress.
OK?

Honza

Mon Sep  2 14:45:37 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* unroll.c (regno): New static function.
	(find_splittable_givs): Handle subregs.

*** unroll.c.old	Mon Sep  2 14:44:16 2002
--- unroll.c	Mon Sep  2 14:43:58 2002
*************** static rtx find_common_reg_term PARAMS (
*** 219,224 ****
--- 219,237 ----
  static rtx subtract_reg_term PARAMS ((rtx, rtx));
  static rtx loop_find_equiv_value PARAMS ((const struct loop *, rtx));
  static rtx ujump_to_loop_cont PARAMS ((rtx, rtx));
+ static unsigned int regno PARAMS ((rtx));
+ 
+ /* Return regno of the register REG and handle subregs too.  */
+ static unsigned int
+ regno (reg)
+      rtx reg;
+ {
+   if (REG_P (reg))
+     return REGNO (reg);
+   if (GET_CODE (reg) == SUBREG)
+     return REGNO (SUBREG_REG (reg));
+   abort ();
+ }
  
  /* Try to unroll one loop and split induction variables in the loop.
  
*************** find_splittable_givs (loop, bl, unroll_t
*** 2868,2874 ****
  		  value = tem;
  		}
  
! 	      splittable_regs[REGNO (v->new_reg)] = value;
  	    }
  	  else
  	    {
--- 2881,2887 ----
  		  value = tem;
  		}
  
! 	      splittable_regs[regno (v->new_reg)] = value;
  	    }
  	  else
  	    {
*************** find_splittable_givs (loop, bl, unroll_t
*** 3047,3067 ****
  		 itself does not have to be splittable.  */
  
  	      if (v->same && v->same->giv_type == DEST_REG)
! 		addr_combined_regs[REGNO (v->same->new_reg)] = v->same;
  
  	      if (GET_CODE (v->new_reg) == REG)
  		{
  		  /* This giv maybe hasn't been combined with any others.
  		     Make sure that it's giv is marked as splittable here.  */
  
! 		  splittable_regs[REGNO (v->new_reg)] = value;
  
  		  /* Make it appear to depend upon itself, so that the
  		     giv will be properly split in the main loop above.  */
  		  if (! v->same)
  		    {
  		      v->same = v;
! 		      addr_combined_regs[REGNO (v->new_reg)] = v;
  		    }
  		}
  
--- 3060,3080 ----
  		 itself does not have to be splittable.  */
  
  	      if (v->same && v->same->giv_type == DEST_REG)
! 		addr_combined_regs[regno (v->same->new_reg)] = v->same;
  
  	      if (GET_CODE (v->new_reg) == REG)
  		{
  		  /* This giv maybe hasn't been combined with any others.
  		     Make sure that it's giv is marked as splittable here.  */
  
! 		  splittable_regs[regno (v->new_reg)] = value;
  
  		  /* Make it appear to depend upon itself, so that the
  		     giv will be properly split in the main loop above.  */
  		  if (! v->same)
  		    {
  		      v->same = v;
! 		      addr_combined_regs[regno (v->new_reg)] = v;
  		    }
  		}
  
*************** find_splittable_givs (loop, bl, unroll_t
*** 3098,3104 ****
  	  if (! v->ignore)
  	    count = REG_IV_CLASS (ivs, REGNO (v->src_reg))->biv_count;
  
! 	  splittable_regs_updates[REGNO (v->new_reg)] = count;
  	}
  
        result++;
--- 3111,3117 ----
  	  if (! v->ignore)
  	    count = REG_IV_CLASS (ivs, REGNO (v->src_reg))->biv_count;
  
! 	  splittable_regs_updates[regno (v->new_reg)] = count;
  	}
  
        result++;


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