From patchwork Mon Sep 19 21:38:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 671952 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 3sdK5r6D59z9s65 for ; Tue, 20 Sep 2016 07:39:12 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=crBlWqBf; 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:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=G2E51UZZYZVJO9/q1HbAEIo5mBmmTlrDV/l7qgpbgII3MIgJo353x WqxwrZC5/P4/B2qzGfJS4GrmiAZAsjQNFy9enVFNQtUDwpcFN/D2ddRfzNwFB9zq c5XNl/Y6TgYU/5TlIEPuy0oHoFI6ALL82fEHsKYHsDnfpIfqeHwTBI= 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:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=xK+NOjcD5gnEDuD/q/Xs8Xue5XQ=; b=crBlWqBfVEbUtF4+iNuz zsZc32t1Dl52AxB5TNRmK0g3oAxa5iDxHbD1vO9mHp9dEphgtie/sE+X4t+q5jTk QyKRLDMTMF3paDgPITAt+AJY1hvZXG32hM7x6YW5VylIAjMtETBOHUm7KM8TwD4R o1+E5dfigOP7aN9yX+aaqzs= Received: (qmail 8026 invoked by alias); 19 Sep 2016 21:39:03 -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 8007 invoked by uid 89); 19 Sep 2016 21:39:03 -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=370, 6, 3706, Vladimir, Makarov 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; Mon, 19 Sep 2016 21:38:53 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 D241331B32C for ; Mon, 19 Sep 2016 21:38:51 +0000 (UTC) Received: from brix.home (ovpn-112-54.phx2.redhat.com [10.3.112.54]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8JLcome000816 for ; Mon, 19 Sep 2016 17:38:51 -0400 From: Vladimir N Makarov Subject: patch to fix PR77416 To: "gcc-patches@gcc.gnu.org" Message-ID: <57E05AE9.5080503@redhat.com> Date: Mon, 19 Sep 2016 17:38:49 -0400 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 fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77416 The patch was tested on ppc64 and bootstrapped on x86-64. Committed as rev. 240247. Index: ChangeLog =================================================================== --- ChangeLog (revision 240246) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2016-09-19 Vladimir Makarov + + PR rtl-optimization/77416 + * lra-remat.c (operand_to_remat): Process hard coded insn + registers. + 2016-09-19 Kyrylo Tkachov * simplify-rtx.c (simplify_relational_operation_1): Add transformation Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 240246) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2016-09-19 Vladimir Makarov + + PR rtl-optimization/77416 + * gcc.target/powerpc/pr77416.c: New. + 2016-09-19 Patrick Palka PR c++/77639 Index: lra-remat.c =================================================================== --- lra-remat.c (revision 240246) +++ lra-remat.c (working copy) @@ -370,6 +370,22 @@ operand_to_remat (rtx_insn *insn) + hard_regno_nregs[reg->regno][reg->biggest_mode]))) return -1; } + /* Check hard coded insn registers. */ + for (struct lra_insn_reg *reg = static_id->hard_regs; + reg != NULL; + reg = reg->next) + if (reg->type == OP_INOUT) + return -1; + else if (reg->type == OP_IN) + { + /* Check that there is no output hard reg as the input + one. */ + for (struct lra_insn_reg *reg2 = static_id->hard_regs; + reg2 != NULL; + reg2 = reg2->next) + if (reg2->type == OP_OUT && reg->regno == reg2->regno) + return -1; + } /* Find the rematerialization operand. */ int nop = static_id->n_operands; for (int i = 0; i < nop; i++) Index: testsuite/gcc.target/powerpc/pr77416.c =================================================================== --- testsuite/gcc.target/powerpc/pr77416.c (revision 0) +++ testsuite/gcc.target/powerpc/pr77416.c (working copy) @@ -0,0 +1,34 @@ +/* { dg-do compile { target { powerpc64*-*-*} } } */ +/* { dg-skip-if "" { powerpc64-*-aix* } { "*" } { "" } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc64*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-options "-mcpu=power7 -O2 -m32" } */ +/* { dg-final { scan-assembler-times "addze" 1 } } */ + +extern int fn2 (); +extern void fn3 (); +extern void fn4 (int); +int a, c, d, f, g, h, i, j, k, l, m, n; +struct +{ + int escape; +} *b; +int e[8]; +void +fn1 (int p1, int p2) +{ + int o = a; + for (; f; f++) + { + int p; + if (e[h]) + continue; + if (fn2 (o, d, l, n, p1, i, j, k, 0==0)) + continue; + p = p2; + if (b[g].escape) + p++; + fn3 ("", c, m); + if (k) + fn4 (p); + } +}