From patchwork Mon Dec 20 22:37:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 76241 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 9A85DB7088 for ; Tue, 21 Dec 2010 09:37:36 +1100 (EST) Received: (qmail 23853 invoked by alias); 20 Dec 2010 22:37:34 -0000 Received: (qmail 23845 invoked by uid 22791); 20 Dec 2010 22:37:34 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Dec 2010 22:37:29 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBKMbRrW006899 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 20 Dec 2010 17:37:28 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBKMbRuS016502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 20 Dec 2010 17:37:27 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id oBKMbQCZ011824 for ; Mon, 20 Dec 2010 23:37:26 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id oBKMbQMw011822 for gcc-patches@gcc.gnu.org; Mon, 20 Dec 2010 23:37:26 +0100 Date: Mon, 20 Dec 2010 23:37:26 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] 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> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 PR rtl-optimization/47008 * postreload.c (reload_combine_note_store): Also handle PRE_MODIFY and POST_MODIFY. * gfortran.dg/pr47008.f03: New test. Jakub --- 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