From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12753 invoked by alias); 12 Apr 2011 16:19:23 -0000 Received: (qmail 12745 invoked by uid 22791); 12 Apr 2011 16:19:22 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SARE_RMML_Stock1,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; Tue, 12 Apr 2011 16:19:08 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3CGJ066002800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Apr 2011 12:19:00 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p3CGIxni003779; Tue, 12 Apr 2011 12:19:00 -0400 Received: from [10.3.113.84] (ovpn-113-84.phx2.redhat.com [10.3.113.84]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p3CGIwNB030648; Tue, 12 Apr 2011 12:18:58 -0400 Message-ID: <4DA47B72.7010005@redhat.com> Date: Tue, 12 Apr 2011 16:19:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.9 MIME-Version: 1.0 To: Bernd Schmidt CC: GCC Patches , Andrew Stubbs Subject: Re: Fix PR47976 References: <4D9D963B.7070001@codesourcery.com> In-Reply-To: <4D9D963B.7070001@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg00905.txt.bz2 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 04/07/11 04:47, Bernd Schmidt wrote: > PR47976 is a followup to PR47166; the patch there caused this problem. > > The problem occurs in reload. There are two autoinc addresses which > inherit from one another, and we delete an insn that is necessary. > > We reach this code when reloading the second autoinc address: > > 6821 if (optimize && REG_P (oldequiv) > 6822 && REGNO (oldequiv) < FIRST_PSEUDO_REGISTER > 6823 && spill_reg_store[REGNO (oldequiv)] > 6824 && REG_P (old) > (gdb) > 6825 && (dead_or_set_p (insn, > 6826 spill_reg_stored_to[REGNO (oldequiv)]) > 6827 || rtx_equal_p (spill_reg_stored_to[REGNO (oldequiv)], > 6828 old))) > 6829 delete_output_reload (insn, j, REGNO (oldequiv), reloadreg); > > reload_inherited[j] is 1 at this point, so oldequiv == reloadreg. > > (gdb) p debug_rtx (spill_reg_store[7]) > (insn 719 718 232 10 (set (reg:SI 7 r7) > (reg:SI 3 r3 [orig:339 ivtmp.79 ] [339])) -1 (nil)) > (gdb) p debug_rtx (spill_reg_stored_to[7]) > (reg:SI 3 r3) > > Prior to the PR47166 patch, we had spill_reg_store[7] equal to insn 718, > which doesn't involve register 7 at all: > > (insn 718 221 719 10 (set (reg:SI 3 r3 [orig:339 ivtmp.79 ] [339]) > (plus:SI (reg:SI 3 r3 [orig:339 ivtmp.79 ] [339]) > (const_int 8 [0x8]))) 4 {*arm_addsi3} (nil)) > > That was sufficient to generate enough confusion to make the compiler > think it couldn't delete the output reload. > > I think the problem is simply that the (set (r7) (r3)) is the opposite > direction of a normal spill_reg_store - normally you write a spill reg > to its destination, but autoinc reloads are somewhat special. > > If delete_output_reload isn't valid for (at least some) autoincs, we can > simply not record them in spill_reg_store. That's part of the patch > below; it seems to fix the problem. I've also deleted the code quoted > above since it's pointless to have reload deleting dead stores to > registers: that's what DCE is for. I've observed no code generation > changes other than for the testcase from either of these changes, with > both an ARM and an sh compiler. > > Comments? Looks good to me. I like letting DCE do its job, particularly if it allows us to even trivially simplify this code ;-) jeff -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNpHtxAAoJEBRtltQi2kC7ytcIAJdW61u1Ugy/56D3mB/J+V8D FbGgaJSAfdFd2JJm9zCEQUye6VqaQRKdakaH+lCQsuMyFZ0n4/1E3p+4FQnVzUS7 fYrP326TeUZeS0HussNYjA+vINXROgoUyL1OpjU/juIbIZMSkcjPO/v44UmN73iV CZpcfOBwRsWSLq9PHtgjkR8ySNCU7KkIMjnmo46zoMHLkDWGRjJETlNJx3fVX3A8 wG1WvKKS4HUYhuFwMRh8t4H50CDGty1UpdaJ30skfqvGJvldGrQ9l3twMezTrxCj rWZiONdZbmYxMZQW90E82+eHh3+wAX/fUwRkeDVIGaNCN5ojkn0TCeFDh9e3l7c= =PDfh -----END PGP SIGNATURE-----