diff mbox

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

Message ID 20101220223726.GD16156@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Dec. 20, 2010, 10:37 p.m. UTC
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

Comments

Jeff Law Dec. 21, 2010, 2:48 p.m. UTC | #1
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
diff mbox

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