From patchwork Wed Sep 29 20:57:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 66097 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 CA298B6F07 for ; Thu, 30 Sep 2010 06:57:07 +1000 (EST) Received: (qmail 31543 invoked by alias); 29 Sep 2010 20:57:06 -0000 Received: (qmail 31534 invoked by uid 22791); 29 Sep 2010 20:57:05 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Sep 2010 20:57:00 +0000 Received: (qmail 23635 invoked from network); 29 Sep 2010 20:56:58 -0000 Received: from unknown (HELO ?84.152.215.26?) (bernds@127.0.0.2) by mail.codesourcery.com with ESMTPA; 29 Sep 2010 20:56:58 -0000 Message-ID: <4CA3A841.6000807@codesourcery.com> Date: Wed, 29 Sep 2010 22:57:37 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.9) Gecko/20100911 Lightning/1.0b3pre Thunderbird/3.1.3 MIME-Version: 1.0 To: IainS CC: GCC Patches , "Vladimir N. Makarov" Subject: Re: Followup for reg_equiv_invariant patch: Fix PR39871 References: <4C16B0B4.6080604@codesourcery.com> <20100614223547.dwf4izvnn4s0wgcc-nzlynne@webmail.spamcop.net> <4C1702DD.9010506@redhat.com> <20100615020004.7gsvdqoa8sg4skwo-nzlynne@webmail.spamcop.net> <4C175C23.3000501@codesourcery.com> <4C1A9971.5000502@codesourcery.com> <9A4C9FCF-2527-4BCA-B217-F835012D5A57@sandoe-acoustics.co.uk> <4C54373F.9050400@codesourcery.com> In-Reply-To: <4C54373F.9050400@codesourcery.com> 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 On 07/31/2010 04:46 PM, Bernd Schmidt wrote: > On 07/24/2010 03:09 PM, IainS wrote: >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45054 > In replace_pseudos_in, we have a series of if statements, which tries to > pick the correct new home from the various possible alternatives. This > seems to need a check for reg_equiv_invariant. > > The other is a crash because when compiling a function with 120 or so > registers, spilled_pseudos has bit 165 set from the previous function I finally spent some time debugging why the latter problem happens. We do clear spilled_pseudos once we're done with the main work inside reload. When we call replace_pseudos_in to replace a pseudo in a CALL_INSN_FUNCTION_USAGE, we call eliminate_regs, which will eventually cause alter_reg to be called if the pseudo is reg_equiv_invariant. We shouldn't really get into alter_reg at this point; if we do, it sets the corresponding bit in spilled_pseudos. Fixed by using eliminate_regs_1 instead, with the may_use_invariant arg set to true. Bootstrapped and regression tested on i686-linux and committed. Bernd Index: ChangeLog =================================================================== --- ChangeLog (revision 164732) +++ ChangeLog (working copy) @@ -11,6 +11,11 @@ costs_add_n_insns): New inline functions. (get_full_rtx_cost): Declare. + PR c/45054 + * reload1.c (replace_pseudos_in): Use eliminate_regs_1, allowing + invariants. Check for reg_equiv_invariant. + (reload): Assert that spilled_pseudos is empty when returning. + 2010-09-29 Kai Tietz * config/i386/mingw32.h (TARGET_64BIT): replaced by Index: reload1.c =================================================================== --- reload1.c (revision 164551) +++ reload1.c (working copy) @@ -588,7 +588,7 @@ replace_pseudos_in (rtx *loc, enum machi if (regno < FIRST_PSEUDO_REGISTER) return; - x = eliminate_regs (x, mem_mode, usage); + x = eliminate_regs_1 (x, mem_mode, usage, true, false); if (x != *loc) { *loc = x; @@ -598,6 +598,8 @@ replace_pseudos_in (rtx *loc, enum machi if (reg_equiv_constant[regno]) *loc = reg_equiv_constant[regno]; + else if (reg_equiv_invariant[regno]) + *loc = reg_equiv_invariant[regno]; else if (reg_equiv_mem[regno]) *loc = reg_equiv_mem[regno]; else if (reg_equiv_address[regno]) @@ -1316,6 +1318,8 @@ reload (rtx first, int global) VEC_free (rtx_p, heap, substitute_stack); + gcc_assert (bitmap_empty_p (&spilled_pseudos)); + return failure; }