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

Re: update_equiv_regs() and dependency chains


   From: "David S. Miller" <davem@redhat.com>
   Date: Fri, 17 May 2002 04:35:10 -0700 (PDT)
   
[ Replying to myself as often occurs... :-) ]

   update_equiv_regs() seems to not be able to handle reg_equiv[] sources
   that are first replaced by other equivalences.
 ...   
   So now we have a problem because the 'src' in reg_equiv[120] still
   refers to REG 184 even though we've killed it off.  That is, the
   reg_equiv[].src members are not updated when an equivalence
   transformation is performed.

So after some thought on how to deal with this, it seems that the
easiest solution is to record the source using the address of the RTX.

This way, if a replacement occurs it will propagate into the sources
of other equivalences.  I thought about how changes to the RTX pointed
to might invalidate our equivalence tests.  That should be OK because
we will be replacing the source with something else known to be
equivalent.  QED :-)

This patch below fixes the ICE in PR c/6689, and the resulting RTL
looks fine.  I'm testing a full bootstrap/testsuite run of this right
now on sparc-linux, and I'll fire one up on sparc64-linux and
i686-linux as well to really make sure this change doesn't have some
weird side effect.

Mark, this is a regression from 3.0 and egcs-1.1.x  Ok for the branch
if all of my bootstrap+regression runs pass?

2002-05-17  David S. Miller  <davem@redhat.com>

	PR c/6689
	* local-alloc.c (struct equivalence): Rename 'src' to 'src_p'
	and make it a pointer to rtx.  Update comments.
	(update_equiv_regs): When scanning for equivalences, record
	address of SET_SRC (set) in reg_equiv[].src_p.  Dereference
	it while making the equiv replacements.

--- local-alloc.c.~1~	Tue Apr  2 18:09:12 2002
+++ local-alloc.c	Fri May 17 06:26:46 2002
@@ -245,7 +245,7 @@ static rtx this_insn;
 struct equivalence
 {
   /* Set when an attempt should be made to replace a register
-     with the associated src entry.  */
+     with the associated src_p entry.  */
 
   char replace;
 
@@ -255,7 +255,7 @@ struct equivalence
 
   rtx replacement;
 
-  rtx src;
+  rtx *src_p;
 
   /* Loop depth is used to recognize equivalences which appear
      to be present within the same loop (or in an inner loop).  */
@@ -1004,7 +1004,7 @@ update_equiv_regs ()
 		recorded_label_ref = 1;
 
 	      reg_equiv[regno].replacement = XEXP (note, 0);
-	      reg_equiv[regno].src = src;
+	      reg_equiv[regno].src_p = &SET_SRC (set);
 	      reg_equiv[regno].loop_depth = loop_depth;
 
 	      /* Don't mess with things live during setjmp.  */
@@ -1086,7 +1086,7 @@ update_equiv_regs ()
 
 		  if (asm_noperands (PATTERN (equiv_insn)) < 0
 		      && validate_replace_rtx (regno_reg_rtx[regno],
-					       reg_equiv[regno].src, insn))
+					       *(reg_equiv[regno].src_p), insn))
 		    {
 		      rtx equiv_link;
 		      rtx last_link;


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