From patchwork Wed Dec 21 22:25:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 88786 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp2507416qgi; Wed, 21 Dec 2016 14:26:29 -0800 (PST) X-Received: by 10.99.48.68 with SMTP id w65mr11518525pgw.68.1482359189894; Wed, 21 Dec 2016 14:26:29 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id o185si4507403pfb.195.2016.12.21.14.26.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Dec 2016 14:26:29 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444956-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-444956-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444956-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=vKIBVHTasuI39rdOnP3YyJ99OEPB47aDaqZAEZZMqRJnPWKQO6 x80F6SZPNIe+I0aqyTr3xYvtK6hDBQL1KraCaupfZ3GmKmRQVu0TFBp0S0ox7/zJ nq2PLbSTgNXqyuCA1zl4NcksBwvJbUb23HhPIO8qdRSbceONstR/OCn6c= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=RyNQcadXGkAQ9jU4B5gwmITvziw=; b=SAM9YW2gqJxMXqbDg2o7 45kk3FoBNts3u401g52ufE21A8SXlkYZs0XE/V7nb25UnSLdrUDyqdxYx0o8BL/j 96qvQzBp1lWbe/HyU/zJEBwwqeAQw+wTJox1Rw4lRDUNuU//C8IdLcppy4g2z2QO fPNTyvlIOiRYHOqlCNCojYE= Received: (qmail 29550 invoked by alias); 21 Dec 2016 22:26:08 -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 29522 invoked by uid 89); 21 Dec 2016 22:26:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com 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, 21 Dec 2016 22:25:57 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02DB38EB51 for ; Wed, 21 Dec 2016 22:25:56 +0000 (UTC) Received: from brix.home (ovpn-118-130.rdu2.redhat.com [10.10.118.130]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBLMPsmb007330 for ; Wed, 21 Dec 2016 17:25:55 -0500 To: "gcc-patches@gcc.gnu.org" From: Vladimir N Makarov Subject: patch to fix PR78580 Message-ID: <0293497d-9b1a-b8e3-b3df-f5ee0dbf37e6@redhat.com> Date: Wed, 21 Dec 2016 17:25:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 X-IsSubscribed: yes The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78580 The patch was successfully tested and bootstrapped on x86-64. Committed to the trunk as rev. 243875. Index: ChangeLog =================================================================== --- ChangeLog (revision 243873) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2016-12-21 Vladimir Makarov + + PR rtl-optimization/78580 + * ira-costs.c (find_costs_and_classes): Make regno_aclass + translated into an allocno class. + 2016-12-21 Pat Haugen PR rtl-optimization/11488 Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 243873) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2016-12-21 Vladimir Makarov + + PR rtl-optimization/78580 + * gcc.target/i386/pr78580.c: New. + 2016-12-21 Jakub Jelinek PR c++/77830 Index: ira-costs.c =================================================================== --- ira-costs.c (revision 243533) +++ ira-costs.c (working copy) @@ -1846,14 +1846,19 @@ find_costs_and_classes (FILE *dump_file) short in -O0 code and so register pressure tends to be low. Avoid that by ignoring the alternative class if the best - class has plenty of registers. */ - regno_aclass[i] = best; + class has plenty of registers. + + The union class arrays give important classes and only + part of it are allocno classes. So translate them into + allocno classes. */ + regno_aclass[i] = ira_allocno_class_translate[best]; else { /* Make the common class the biggest class of best and - alt_class. */ - regno_aclass[i] - = ira_reg_class_superunion[best][alt_class]; + alt_class. Translate the common class into an + allocno class too. */ + regno_aclass[i] = (ira_allocno_class_translate + [ira_reg_class_superunion[best][alt_class]]); ira_assert (regno_aclass[i] != NO_REGS && ira_reg_allocno_class_p[regno_aclass[i]]); } Index: testsuite/gcc.target/i386/pr78580.c =================================================================== --- testsuite/gcc.target/i386/pr78580.c (nonexistent) +++ testsuite/gcc.target/i386/pr78580.c (working copy) @@ -0,0 +1,18 @@ +/* PR rtl-optimization/78580 */ +/* { dg-do compile } */ +/* { dg-options "-O0 -ffixed-ebx" } */ + +extern const signed char a; + +int +foo (signed char x) +{ + return x; +} + +int +main () +{ + foo (a); + return 0; +}