From patchwork Wed Sep 18 18:25:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 275775 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6069B2C00B7 for ; Thu, 19 Sep 2013 04:25:44 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=yZvZiiiF7l00yTlbed7l2N9puJgKpYb0ifmXJSEgOKRLuw KCY/DkMGX01FkcxR694OaJC2LSA+UynN/toGjEbnMwV2afukiNCWY7fA/WTAQPXT x9Ezno6VAlacoTRTgoYg0R0sRieJcTXshqOhaoOR3aRfM6gKMtYA9RWyIK1mc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=9w3h4/bowVKlQ2SxIXu1ilzgUVo=; b=s3jo9Quz3uzMORCWC3la L0jEfay9DFBaB8kurTkj726ehsep+xfE7cP/sEKKMrXzhcJGyEeNaq/3Y86OZ5pG NXZI9/cob5soL7/c4YRr7nSk9HOaRPEtnTZGJ0pr+eOocxIKfw52chZXu6QYvdMB wSJ1VrXqUsnHv9YjDdHUhGY= Received: (qmail 23125 invoked by alias); 18 Sep 2013 18:25:36 -0000 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 Received: (qmail 23112 invoked by uid 89); 18 Sep 2013 18:25:35 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Sep 2013 18:25:35 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8IIPUae010945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 18 Sep 2013 14:25:30 -0400 Received: from topor.usersys.redhat.com ([10.15.16.142]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8IIPUIx024037 for ; Wed, 18 Sep 2013 14:25:30 -0400 Message-ID: <5239F01A.4050705@redhat.com> Date: Wed, 18 Sep 2013 14:25:30 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: gcc-patches Subject: patch to fix PR58348 X-IsSubscribed: yes The following patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58438 The patch was successfully bootstrapped and tested on x86/x86-64. Committed as rev. 202714. 2013-09-18 Vladimir Makarov PR rtl-optimization/58438 * lra.c (lra): Clear lra_optional_reload_pseudos in upper loop. * lra-constraints.c (undo_optional_reloads): Keep optional reloads from previous subpasses. 2013-09-18 Vladimir Makarov PR rtl-optimization/58438 * g++.dg/pr58438.C: New test. Index: lra.c =================================================================== --- lra.c (revision 202626) +++ lra.c (working copy) @@ -2315,7 +2315,6 @@ lra (FILE *f) { for (;;) { - bitmap_clear (&lra_optional_reload_pseudos); /* We should try to assign hard registers to scratches even if there were no RTL transformations in lra_constraints. */ @@ -2367,6 +2366,9 @@ lra (FILE *f) lra_clear_live_ranges (); } } + /* Don't clear optional reloads bitmap until all constraints are + satisfied as we need to differ them from regular reloads. */ + bitmap_clear (&lra_optional_reload_pseudos); bitmap_clear (&lra_subreg_reload_pseudos); bitmap_clear (&lra_inheritance_pseudos); bitmap_clear (&lra_split_regs); Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 202630) +++ lra-constraints.c (working copy) @@ -5456,10 +5456,12 @@ undo_optional_reloads (void) EXECUTE_IF_SET_IN_BITMAP (&lra_optional_reload_pseudos, 0, regno, bi) { keep_p = false; - if (reg_renumber[lra_reg_info[regno].restore_regno] >= 0) - /* If the original pseudo changed its allocation, just - removing the optional pseudo is dangerous as the original - pseudo will have longer live range. */ + /* Keep optional reloads from previous subpasses. */ + if (lra_reg_info[regno].restore_regno < 0 + /* If the original pseudo changed its allocation, just + removing the optional pseudo is dangerous as the original + pseudo will have longer live range. */ + || reg_renumber[lra_reg_info[regno].restore_regno] >= 0) keep_p = true; else if (reg_renumber[regno] >= 0) EXECUTE_IF_SET_IN_BITMAP (&lra_reg_info[regno].insn_bitmap, 0, uid, bi2)