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]
Other format: [Raw text]

Re: Fix sharing of clobbers


On 03/11/2013 12:06 PM, Jan Hubicka wrote:
Hi,
in the testcase we die in post-reload cprop because updating one insn clobber
actually affect other insn clobber.  I actually introduced clobber sharing back
in 2005 to save memory for (clobber cc0).  This broke with introduction of post-reload
code copying that is now done by shrink wrapping.

Fixed by unsharing those clobbers that originate from pseudos.
Bootstrapped/regtested x86_64-linux, OK?

	PR middle-end/56571
	* valtrack.c (cleanup_auto_inc_dec): Unshare clobbers originating
	from pseudos.
	* emit-rtl.c (verify_rtx_sharing): Likewise.
	(copy_insn_1): Likewise.
	* rtl.c (copy_rtx): Likewise.

* gcc.c-torture/compile/pr56571.c: New testcase.

Index: valtrack.c
===================================================================
*** valtrack.c	(revision 196596)
--- valtrack.c	(working copy)
*************** cleanup_auto_inc_dec (rtx src, enum mach
*** 71,77 ****
         /* SCRATCH must be shared because they represent distinct values.  */
         return x;
       case CLOBBER:
!       if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
   	return x;
         break;

--- 71,78 ----
         /* SCRATCH must be shared because they represent distinct values.  */
         return x;
       case CLOBBER:
!       if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER
! 	  && ORIGINAL_REGNO (XEXP (x, 0)) == REGNO (XEXP (x, 0)))
   	return x;
         break;
Comment? Otherwise one would have to know to look in verify_rtx_sharing to know why clobbers originating from pseudos aren't shared.


*************** copy_insn_1 (rtx orig)
*** 5303,5309 ****
       case SIMPLE_RETURN:
         return orig;
       case CLOBBER:
!       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
   	return orig;
         break;

--- 5311,5318 ----
       case SIMPLE_RETURN:
         return orig;
       case CLOBBER:
!       if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
! 	  && ORIGINAL_REGNO (XEXP (orig, 0)) == REGNO (XEXP (orig, 0)))
   	return orig;
         break;
Similarly.


OK with those changes.


jeff


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