optimization/10592: [arm] caller-save incorrectly handles a reloaded SET_DEST operand

Richard Earnshaw rearnsha@arm.com
Fri May 2 14:03:00 GMT 2003


This patch implements the idea I just suggested, it does indeed seem to 
solve the problem:

With the patch, the relevant bit of the code is now:

        str     ip, [fp, #-44]
        bl      strncpy
        ldr     ip, [fp, #-44]
        add     r2, r9, #156
        add     lr, r9, #16
        str     r2, [ip, #540]


I'll do a full testsuite run to check for regressions.

<date>  Richard Earnshaw  <rearnsha@arm.com>

	* caller-save.c (mark_referenced_regs): Don't short-circuit a reg
	or subreg in SET_DEST if it isn't a hard register.

R.
-------------- next part --------------
Index: caller-save.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/caller-save.c,v
retrieving revision 1.54
diff -p -r1.54 caller-save.c
*** caller-save.c	16 Dec 2002 18:19:05 -0000	1.54
--- caller-save.c	2 May 2003 13:57:25 -0000
*************** mark_referenced_regs (x)
*** 575,582 ****
      {
        x = SET_DEST (x);
        code = GET_CODE (x);
!       if (code == REG || code == PC || code == CC0
  	  || (code == SUBREG && GET_CODE (SUBREG_REG (x)) == REG
  	      /* If we're setting only part of a multi-word register,
  		 we shall mark it as referenced, because the words
  		 that are not being set should be restored.  */
--- 575,584 ----
      {
        x = SET_DEST (x);
        code = GET_CODE (x);
!       if ((code == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
! 	  || code == PC || code == CC0
  	  || (code == SUBREG && GET_CODE (SUBREG_REG (x)) == REG
+ 	      && REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER
  	      /* If we're setting only part of a multi-word register,
  		 we shall mark it as referenced, because the words
  		 that are not being set should be restored.  */


More information about the Gcc-bugs mailing list