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

[RFA] Fix PR rtl-optimization/30807


The attached patch is the updated version of a Joern's patch:

reload_combine bug fix

reload_combine doesn't recode the use of BASE register for
all new uses of REG_SUM.  Then it makes a wrong code which
uses the BASE register already clobbered, in failing case.
The problem is reported for 3.4 and 4.3 as PR30807, though
I believe that it's latent for trunk.
Unfortunately there are test cases only for 3.4/4.3 and all
my efforts to make a test case for trunk fail.  I'd like to
ask if the patch is appropriate for trunk, though.
The patch is tested with bootstrap and the top level "make -k
check" on i686-pc-linux-gnu and powerpc-apple-darwin9.5.0
with no new failures.

OK for trunk?

2009-06-10  J"orn Rennecke  <>
	    Kaz Kojima  <>

	PR rtl-optimization/30807
	* postreload.c (reload_combine): For every new use of REG_SUM,
	record the use of BASE.

--- ORIG/trunk/gcc/postreload.c	2009-04-21 07:22:17.000000000 +0900
+++ trunk/gcc/postreload.c	2009-06-08 11:16:09.000000000 +0900
@@ -891,6 +891,24 @@ reload_combine (void)
 	      if (apply_change_group ())
+		  /* For every new use of REG_SUM, we have to record the use
+		     of BASE therein.  */
+		  for (i = reg_state[regno].use_index;
+		       i < RELOAD_COMBINE_MAX_USES; i++)
+		    {
+		      rtx *basep = &XEXP (*reg_state[regno].reg_use[i].usep, 1);
+		      rtx use_insn = reg_state[regno].reg_use[i].insn;
+		      gcc_assert (*basep == base);
+		      reload_combine_note_use (basep, use_insn);
+		    }
+		  if (reg_state[REGNO (base)].use_ruid
+		      > reg_state[regno].use_ruid)
+		    reg_state[REGNO (base)].use_ruid
+		      = reg_state[regno].use_ruid;
 		  /* Delete the reg-reg addition.  */
 		  delete_insn (insn);

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