From patchwork Wed Mar 2 01:43:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 590830 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 96AAC140B0F for ; Wed, 2 Mar 2016 12:43:32 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ozRmn/5p; dkim-atps=neutral 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=HDUUfp3PF6p2eVqEv+Jb5LdpZKcf/YBL7z4bIThz2KzJCy/FsG en4DMJe6HPvXb+F5q/71BGB5begA1Pk1oGebR6zk+Xz22d3Ayu5acnu2AyC+DVsW /UrbPHlAJk7Ip8ieTlwZpM6mitvX2lLUBPHR3pNwEEodo+PnTn3gaxtc8= 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=VOm8vrS/Od9u60m9yTDPZejB+lk=; b=ozRmn/5pmy5/01iu24X8 1LDwcTOgigDDqcDFPXWpN/wrYhsk/aUpDvkeaQO6tO8Ky2BhGlAnHn1rq09odQBt cHKH8NLykPv0xsqoepwe8nZqqYLh9X9cfGn86ddbaTqinZiCUtzRMViBS5oWMbOI lq6aTwLSy814hZn7JW/kY4Y= Received: (qmail 27234 invoked by alias); 2 Mar 2016 01:43:25 -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 27224 invoked by uid 89); 2 Mar 2016 01:43:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 spammy=Generate 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 02 Mar 2016 01:43:24 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id C9F0B1E3B for ; Wed, 2 Mar 2016 01:43:22 +0000 (UTC) Received: from [10.3.112.18] ([10.3.112.18]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u221hLPA025545 for ; Tue, 1 Mar 2016 20:43:22 -0500 To: gcc-patches From: Vladimir Makarov Subject: patch for PR233876 Message-ID: <56D64539.8050309@redhat.com> Date: Tue, 1 Mar 2016 20:43:21 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 X-IsSubscribed: yes The following patch should fix PR https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70025 The patch was successfully bootstrapped and tested on x86/x86-64. Committed as rev. 233876. I'll work on the test tomorrow -- I have no access to s390x right now. Index: ChangeLog =================================================================== --- ChangeLog (revision 233875) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2016-03-01 Vladimir Makarov + + PR middle-end/70025 + * lra-constraints.c (regno_val_use_in): New. + (match_reload): Use it instead of regno_use_in. + 2016-03-01 Eric Botcazou PR rtl-optimization/70007 Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 233861) +++ lra-constraints.c (working copy) @@ -840,6 +840,36 @@ narrow_reload_pseudo_class (rtx reg, enu lra_change_class (REGNO (reg), rclass, " Change to", true); } +/* Searches X for any reference to a reg with the same value as REGNO, + returning the rtx of the reference found if any. Otherwise, + returns NULL_RTX. */ +static rtx +regno_val_use_in (unsigned int regno, rtx x) +{ + const char *fmt; + int i, j; + rtx tem; + + if (REG_P (x) && lra_reg_info[REGNO (x)].val == lra_reg_info[regno].val) + return x; + + fmt = GET_RTX_FORMAT (GET_CODE (x)); + for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--) + { + if (fmt[i] == 'e') + { + if ((tem = regno_val_use_in (regno, XEXP (x, i)))) + return tem; + } + else if (fmt[i] == 'E') + for (j = XVECLEN (x, i) - 1; j >= 0; j--) + if ((tem = regno_val_use_in (regno , XVECEXP (x, i, j)))) + return tem; + } + + return NULL_RTX; +} + /* Generate reloads for matching OUT and INS (array of input operand numbers with end marker -1) with reg class GOAL_CLASS. Add input and output reloads correspondingly to the lists *BEFORE and *AFTER. @@ -942,7 +972,8 @@ match_reload (signed char out, signed ch = (! early_clobber_p && ins[1] < 0 && REG_P (in_rtx) && (int) REGNO (in_rtx) < lra_new_regno_start && find_regno_note (curr_insn, REG_DEAD, REGNO (in_rtx)) - && (out < 0 || regno_use_in (REGNO (in_rtx), out_rtx) == NULL_RTX) + && (out < 0 + || regno_val_use_in (REGNO (in_rtx), out_rtx) == NULL_RTX) ? lra_create_new_reg (inmode, in_rtx, goal_class, "") : lra_create_new_reg_with_unique_value (outmode, out_rtx, goal_class, ""));