From patchwork Wed Nov 28 17:43:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 202508 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 4B8242C0086 for ; Thu, 29 Nov 2012 04:43:39 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1354729420; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=vZwMZfE b1cz2mEWa9zQpaSghYdE=; b=hqZ6umEV73/SrC8B03iL/DxYE3pYs29BGzZsco3 zcVGcEuO/WyI1l5NRbl6dPlmggkMV+I+0Sq62igxZNyEospGULbv1WWZdr+kFIuf jUfl8mkly6Vcf6A/ysGjC87KkSwtxll50WJcDh0SJCTFEChcRuhuCZa9ENhOJq8Z uuSs= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=rKik8pyYrnv81AQnor07A0JuE3KDx8VUelLFcYsdRuKbcuQQQi9qDIbIhA4NSX ZtvQFhZmMnIHFYvD7391He5cX0i+odUDL+OzVe194SfpgAOjV0da/n8nYIlF5WqJ /Ui2HI65ySghtomGlVZvWijCfYm/BSq/ziNLqQts89pSQ=; Received: (qmail 17054 invoked by alias); 28 Nov 2012 17:43:29 -0000 Received: (qmail 17014 invoked by uid 22791); 28 Nov 2012 17:43:26 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Wed, 28 Nov 2012 17:43:17 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qASHhGrF008748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Nov 2012 12:43:17 -0500 Received: from Mair.local (vpn-8-84.rdu.redhat.com [10.11.8.84]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qASHhFGC013106 for ; Wed, 28 Nov 2012 12:43:16 -0500 Message-ID: <50B64D33.3040505@redhat.com> Date: Wed, 28 Nov 2012 12:43:15 -0500 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: GCC Patches Subject: patch to fix PR55512 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 The following patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55512 The patch was successfully tested and bootstrapped on x86/x86-64. Committed as rev. 193901. 2012-11-28 Vladimir Makarov PR rtl-optimization/55512 * lra-assigns.c (assign_by_spills): Assigned arbitrary hard regs to failed reload pseudos instead of changing asm pattern. * lra-constraints.c (MAX_CONSTRAINT_ITERATION_NUMBER): Increase value. 2012-11-28 Vladimir Makarov PR rtl-optimization/55512 * gcc.target/i386/pr55512-[1234].c: New tests. Index: lra-assigns.c =================================================================== --- lra-assigns.c (revision 193871) +++ lra-assigns.c (working copy) @@ -1220,8 +1220,17 @@ assign_by_spills (void) bitmap_initialize (&failed_reload_insns, ®_obstack); for (i = 0; i < nfails; i++) - bitmap_ior_into (&failed_reload_insns, - &lra_reg_info[sorted_pseudos[i]].insn_bitmap); + { + regno = sorted_pseudos[i]; + bitmap_ior_into (&failed_reload_insns, + &lra_reg_info[regno].insn_bitmap); + /* Assign an arbitrary hard register of regno class to + avoid further trouble with the asm insns. */ + bitmap_clear_bit (&all_spilled_pseudos, regno); + assign_hard_regno + (ira_class_hard_regs[regno_allocno_class_array[regno]][0], + regno); + } EXECUTE_IF_SET_IN_BITMAP (&failed_reload_insns, 0, u, bi) { insn = lra_insn_recog_data[u]->insn; @@ -1230,9 +1239,6 @@ assign_by_spills (void) asm_p = true; error_for_asm (insn, "% operand has impossible constraints"); - /* Avoid further trouble with this insn. */ - PATTERN (insn) = gen_rtx_USE (VOIDmode, const0_rtx); - lra_invalidate_insn_data (insn); } } lra_assert (asm_p); Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 193870) +++ lra-constraints.c (working copy) @@ -3184,7 +3184,7 @@ loc_equivalence_change_p (rtx *loc) /* Maximum allowed number of constraint pass iterations after the last spill pass. It is for preventing LRA cycling in a bug case. */ -#define MAX_CONSTRAINT_ITERATION_NUMBER 15 +#define MAX_CONSTRAINT_ITERATION_NUMBER 30 /* Maximum number of generated reload insns per an insn. It is for preventing this pass cycling in a bug case. */ Index: testsuite/gcc.target/i386/pr55512-1.c =================================================================== --- testsuite/gcc.target/i386/pr55512-1.c (revision 0) +++ testsuite/gcc.target/i386/pr55512-1.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int +foo (int x) +{ + asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */ + "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7), + "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11), + "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15) : : lab); + __builtin_unreachable (); + lab: + return 0; +} Index: testsuite/gcc.target/i386/pr55512-2.c =================================================================== --- testsuite/gcc.target/i386/pr55512-2.c (revision 0) +++ testsuite/gcc.target/i386/pr55512-2.c (working copy) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#define __builtin_unreachable() do { } while (0) + +int +foo (int x) +{ + asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */ + "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7), + "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11), + "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15) : : lab); + __builtin_unreachable (); + lab: + return 0; +} Index: testsuite/gcc.target/i386/pr55512-3.c =================================================================== --- testsuite/gcc.target/i386/pr55512-3.c (revision 0) +++ testsuite/gcc.target/i386/pr55512-3.c (working copy) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int +bar (int x) +{ + asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */ + "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7), + "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11), + "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15), + "r" (x + 16) : : lab); + __builtin_unreachable (); + lab: + return 0; +} Index: testsuite/gcc.target/i386/pr55512-4.c =================================================================== --- testsuite/gcc.target/i386/pr55512-4.c (revision 0) +++ testsuite/gcc.target/i386/pr55512-4.c (working copy) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#define __builtin_unreachable() do { } while (0) + +int +bar (int x) +{ + asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */ + "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7), + "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11), + "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15), + "r" (x + 16) : : lab); + __builtin_unreachable (); + lab: + return 0; +}