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]

REG_DEAD notes and local alloc bug



When doing a final rebuild/test of the subreg initialization code with 
the latest mainline, There was a failure that wasn't there before.
gcc.c-torture/compile/930621-1.c started failing at -O1.

It consisted of a sign extend in a loop which required an initialization.
The insn in the loop was then elimated during combine. When local_alloc() is 
run, the register life info is out of date, so compute_reg_usage() is called.
This routine recalculates the register info, but it doesn't do anything about
the REG_DEAD notes, and local_alloc appears to use them. 

The symptom is that we end up with a set of a register in the first basic 
block, and there is never a REG_DEAD note for it.  local_alloc() fails to 
find a register for it, and aborts. If we recompute the REG_DEAD notes when 
we compute reg usage, it solves the problem.

The reason it didn't show up before is because I made a minor change to the
subreg initialization code.. There was an oversight where I was initializting
either the SUBREG of the register to 0 instead of the register itself. This 
apparently causes local_alloc to do something different. Anyway, when I changed 
it to simply set the register to 0 as it should, the failure surfaced.

Is this right, or should we be doing something else? 

Andrew


	* flow.c (recompute_reg_usage): Propagate REG_DEAD notes when 
	recomputing register usage info.

Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.491
diff -c -p -r1.491 flow.c
*** flow.c	2001/11/11 11:25:18	1.491
--- flow.c	2001/11/22 16:45:12
*************** recompute_reg_usage (f, loop_step)
*** 4020,4026 ****
       int loop_step ATTRIBUTE_UNUSED;
  {
    allocate_reg_life_data ();
!   update_life_info (NULL, UPDATE_LIFE_LOCAL, PROP_REG_INFO);
  }
  
  /* Optionally removes all the REG_DEAD and REG_UNUSED notes from a set of
--- 4128,4134 ----
       int loop_step ATTRIBUTE_UNUSED;
  {
    allocate_reg_life_data ();
!   update_life_info (NULL, UPDATE_LIFE_LOCAL, PROP_REG_INFO | PROP_DEATH_NOTES);
  }
  
  /* Optionally removes all the REG_DEAD and REG_UNUSED notes from a set of


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