reload bug

Joern Rennecke amylaar@cygnus.co.uk
Mon Nov 30 17:59:00 GMT 1998


> Joern, Bernd, if one of you could dive into this I'm sure everyone would
> appreciate it.  This is causing the x86 port to mis-compile itself in some
> circumstances.

I don't have any CPU cycles to spare right now, but from your analysis
of the problem, I'd think this patch should help by clearing
spill_reg_store[0] when processing reload 0 of insn 32.

Tue Dec  1 01:21:04 1998  J"orn Rennecke <amylaar@cygnus.co.uk>

	* reload1.c (emit_reload_insns): Clear spill_reg_store
	when doing a new non-inherited reload from the same pseudo.

Index: reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.104
diff -p -r1.104 reload1.c
*** reload1.c	1998/11/25 10:31:19	1.104
--- reload1.c	1998/12/01 01:20:47
*************** emit_reload_insns (chain)
*** 7282,7287 ****
--- 7282,7315 ----
  	  int part_reaches_end = 0;
  	  int all_reaches_end = 1;
  
+ 	  /* If this is a non-inherited input reload from a pseudo, we must
+ 	     clear any memory of a previous store to the same pseudo.  Only do
+ 	     something if there will not be an output reload for the pseudo
+ 	     being reloaded.  */
+ 	  if (reload_in_reg[r] != 0
+ 	      && ! (reload_inherited[r] || reload_override_in[r]))
+ 	    {
+ 	      rtx reg = reload_in_reg[r];
+ 
+ 	      if (GET_CODE (reg) == SUBREG)
+ 		reg = SUBREG_REG (reg);
+ 	
+ 	      if (GET_CODE (reg) == REG
+ 		  && REGNO (reg) >= FIRST_PSEUDO_REGISTER
+ 		  && ! reg_has_output_reload[REGNO (reg)])
+ 		{
+ 		  int nregno = REGNO (reg);
+ 
+ 		  if (reg_last_reload_reg[nregno])
+ 		    {
+ 		      int last_regno == REGNO (reg_last_reload_reg[nregno]);
+ 
+ 		      if (reg_reloaded_contents[last_regno] == nregno)
+ 			spill_reg_store[last_regno] = 0;
+ 		    }
+ 		}
+ 	    }
+ 		  
  	  /* For a multi register reload, we need to check if all or part
  	     of the value lives to the end.  */
  	  for (k = 0; k < nr; k++)



More information about the Gcc-bugs mailing list