Patchwork Fix postreload with PRE_MODIFY on non-AUTO_INC_DEC targets (PR rtl-optimization/47008)

login
register
mail settings
Submitter Jakub Jelinek
Date Dec. 20, 2010, 10:37 p.m.
Message ID <20101220223726.GD16156@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/76241/
State New
Headers show

Comments

Jakub Jelinek - Dec. 20, 2010, 10:37 p.m.
Hi!

x86_64 is one of the targets that is not AUTO_INC_DEC (thus doesn't use
REG_INC notes), but uses PRE_DEC and in some cases also PRE_MODIFY
for push insns.  reload_combine handles REG_INC notes and
reload_combine_note_stores handles {PRE,POST}_{INC,DEC} for non-AUTO_INC_DEC
targets, but didn't handle PRE_MODIFY/POST_MODIFY (PRE_MODIFY is used for <
DImode pushes).

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2010-12-20  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/47008
	* postreload.c (reload_combine_note_store): Also handle
	PRE_MODIFY and POST_MODIFY.

	* gfortran.dg/pr47008.f03: New test.


	Jakub
Jeff Law - Dec. 21, 2010, 2:48 p.m.
On 12/20/10 15:37, Jakub Jelinek wrote:
> Hi!
>
> x86_64 is one of the targets that is not AUTO_INC_DEC (thus doesn't use
> REG_INC notes), but uses PRE_DEC and in some cases also PRE_MODIFY
> for push insns.  reload_combine handles REG_INC notes and
> reload_combine_note_stores handles {PRE,POST}_{INC,DEC} for non-AUTO_INC_DEC
> targets, but didn't handle PRE_MODIFY/POST_MODIFY (PRE_MODIFY is used for<
> DImode pushes).
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2010-12-20  Jakub Jelinek<jakub@redhat.com>
>
> 	PR rtl-optimization/47008
> 	* postreload.c (reload_combine_note_store): Also handle
> 	PRE_MODIFY and POST_MODIFY.
>
> 	* gfortran.dg/pr47008.f03: New test.
OK.

My bad for not catching this during my recent fix in the same spot.

Thanks,
jeff

Patch

--- gcc/postreload.c.jj	2010-12-02 13:15:24.000000000 +0100
+++ gcc/postreload.c	2010-12-20 14:01:23.404758077 +0100
@@ -1415,7 +1415,8 @@  reload_combine_note_store (rtx dst, cons
     {
       dst = XEXP (dst, 0);
       if (GET_CODE (dst) == PRE_INC || GET_CODE (dst) == POST_INC
-	  || GET_CODE (dst) == PRE_DEC || GET_CODE (dst) == POST_DEC)
+	  || GET_CODE (dst) == PRE_DEC || GET_CODE (dst) == POST_DEC
+	  || GET_CODE (dst) == PRE_MODIFY || GET_CODE (dst) == POST_MODIFY)
 	{
 	  regno = REGNO (XEXP (dst, 0));
 	  mode = GET_MODE (XEXP (dst, 0));
--- gcc/testsuite/gfortran.dg/pr47008.f03.jj	2010-12-20 19:53:41.417869278 +0100
+++ gcc/testsuite/gfortran.dg/pr47008.f03	2010-12-20 19:52:36.000000000 +0100
@@ -0,0 +1,24 @@ 
+! PR rtl-optimization/47008
+! { dg-do run }
+! { dg-options "-Os -fno-asynchronous-unwind-tables -fschedule-insns -fsched-pressure -fno-inline" { target i?86-*-* x86_64-*-* } }
+
+program main
+  type :: t
+    integer :: i
+    character(24) :: c
+    type (t), pointer :: p
+  end type t
+  type(t), pointer :: r, p
+  allocate (p)
+  p = t (123455, "", p)
+  r => entry ("", 123456, 1, "", 99, "", p)
+  if (p%i /= 123455) call abort
+contains
+  function entry (x, i, j, c, k, d, p) result (q)
+    integer :: i, j, k
+    character (*) :: x, c, d
+    type (t), pointer :: p, q
+    allocate (q)
+    q = t (i, c, p)
+  end function
+end program main