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]

Re: Reload inheritance and auto inc/dec


On Sep 14, 2000, Jeffrey A Law <law@cygnus.com> wrote:

>   In message <oru2bj8wms.fsf@guarana.lsd.ic.unicamp.br>you write:

> I don't consider that a valid assumption -- there may be a variety of reasons
> why we don't want to use that value.

Yep.  I managed to figure out some of those reasons by myself :-)

>> I think it's ok, (reg:SI 130) doesn't change during the life of the
>> pseudo.

> The scope of a REG_EQUIV note is the entire function.

Ok, but since the pseudo only exists during a short interval, and
reg:SI doesn't change in that interval, any occurrence of the pseudo
can be safely replaced by the REG_EQUIV rtx.  Wouldn't this be a valid
use of REG_EQUIV?


Anyway, this is totally unrelated with the problem at hand.  The
actual problem shows up before that insn is considered.
Unfortunately, I can't create a testcase that fails reliably; minor
perturbations in other optimization passes can change the RTL at the
beginning of reload in such a way that the bug hides away :-(

But I've got a patch that addresses the actual problem: we failed to
update reg_last_reload_reg when generating the reloads for the pseudo
referenced by the auto_inc mem.  That was the reason why the wrong
register was chosen for inheritance afterwards.  And here's a patch
that fixes this problem.  Unlike the previous patch, this one doesn't
introduce regressions in a sh-elf testsuite run.  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* reload.c (find_reloads_address_1): General reloads for auto_inc
	pseudos that refer to the original pseudos, not only to their
	equivalent memory locations.

Index: gcc/reload.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload.c,v
retrieving revision 1.128
diff -u -p -r1.128 reload.c
--- gcc/reload.c 2000/09/11 13:13:00 1.128
+++ gcc/reload.c 2000/09/14 14:43:49
@@ -5278,8 +5278,12 @@ find_reloads_address_1 (mode, x, context
 		{
 		  loc = &XEXP (x, 0);
 		  x = XEXP (x, 0);
+		  /* We use the original pseudo for output, so that
+		     emit_reload_insns() knows which pseudo this
+		     reload refers to and updates the corresponding
+		     entry in reg_last_reload_reg.  */
 		  reloadnum
-		    = push_reload (x, x, loc, loc,
+		    = push_reload (x, XEXP (x_orig, 0), loc, &XEXP (x_orig, 0),
 				   (context ? INDEX_REG_CLASS : BASE_REG_CLASS),
 				   GET_MODE (x), GET_MODE (x), 0, 0,
 				   opnum, RELOAD_OTHER);

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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