Patchwork caller-save adjust_address fix

login
register
mail settings
Submitter Alan Modra
Date June 10, 2010, 1:04 a.m.
Message ID <20100610010440.GN7312@bubble.grove.modra.org>
Download mbox | patch
Permalink /patch/55139/
State New
Headers show

Comments

Alan Modra - June 10, 2010, 1:04 a.m.
This patch fixes an ICE in change_address_1 seen when a caller-save
slot is needed in a different mode to that in which it is created, and
the stack offset is too large for valid reg+offset addressing.
Refer http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44364#c38
Fairly obvious, since if no mode change is needed then we simply copy
the mem regardless of whether the offset is valid or not.
Bootstrapped etc. powerpc-linux.  OK to apply?

	PR target/44364
	* caller-save.c (insert_restore, insert_save): Use non-validate
	form of adjust_address.
Alan Modra - June 20, 2010, 2:33 a.m.
On Thu, Jun 10, 2010 at 10:34:40AM +0930, Alan Modra wrote:
> 	PR target/44364
> 	* caller-save.c (insert_restore, insert_save): Use non-validate
> 	form of adjust_address.

Ping?  http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01033.html
Jeff Law - June 21, 2010, 3:46 p.m.
On 06/09/10 19:04, Alan Modra wrote:
> This patch fixes an ICE in change_address_1 seen when a caller-save
> slot is needed in a different mode to that in which it is created, and
> the stack offset is too large for valid reg+offset addressing.
> Refer http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44364#c38
> Fairly obvious, since if no mode change is needed then we simply copy
> the mem regardless of whether the offset is valid or not.
> Bootstrapped etc. powerpc-linux.  OK to apply?
>
> 	PR target/44364
> 	* caller-save.c (insert_restore, insert_save): Use non-validate
> 	form of adjust_address.
>    
So with this change we rely on reload to detect the out-of-range offset 
and reload it, right?  Assuming that's the case, this patch is OK.

Jeff
Alan Modra - June 22, 2010, 9:30 a.m.
On Mon, Jun 21, 2010 at 09:46:47AM -0600, Jeff Law wrote:
> On 06/09/10 19:04, Alan Modra wrote:
> >This patch fixes an ICE in change_address_1 seen when a caller-save
> >slot is needed in a different mode to that in which it is created, and
> >the stack offset is too large for valid reg+offset addressing.
> >Refer http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44364#c38
> >Fairly obvious, since if no mode change is needed then we simply copy
> >the mem regardless of whether the offset is valid or not.
> >Bootstrapped etc. powerpc-linux.  OK to apply?
> >
> >	PR target/44364
> >	* caller-save.c (insert_restore, insert_save): Use non-validate
> >	form of adjust_address.
> So with this change we rely on reload to detect the out-of-range
> offset and reload it, right?  Assuming that's the case, this patch
> is OK.

Yes.  Well, actually we rely on reload to fix up out-of-range save
slot offsets *before* this patch.  The patch just allows out-of-range
offsets with a save slot mode change as well as out-of-range offsets
without mode changes.

Patch

Index: gcc/caller-save.c
===================================================================
--- gcc/caller-save.c	(revision 160429)
+++ gcc/caller-save.c	(working copy)
@@ -1212,7 +1212,7 @@  insert_restore (struct insn_chain *chain
       /* Check that insn to restore REGNO in save_mode[regno] is
 	 correct.  */
       && reg_save_code (regno, save_mode[regno]) >= 0)
-    mem = adjust_address (mem, save_mode[regno], 0);
+    mem = adjust_address_nv (mem, save_mode[regno], 0);
   else
     mem = copy_rtx (mem);
 
@@ -1293,7 +1293,7 @@  insert_save (struct insn_chain *chain, i
       /* Check that insn to save REGNO in save_mode[regno] is
 	 correct.  */
       && reg_save_code (regno, save_mode[regno]) >= 0)
-    mem = adjust_address (mem, save_mode[regno], 0);
+    mem = adjust_address_nv (mem, save_mode[regno], 0);
   else
     mem = copy_rtx (mem);