From patchwork Fri Mar 13 19:06:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 1254622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=tqdIWf4w; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48fFYr10d7z9sPF for ; Sat, 14 Mar 2020 06:07:10 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CFBA43AA88D9; Fri, 13 Mar 2020 19:07:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CFBA43AA88D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1584126426; bh=FjZORCPPmnVAXdkr6fS5h6FrHIjPhgJXyGKp5u+ItXo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=tqdIWf4wcJn4GxYwuLw06eVCxS01VGPCdcWUtAEeQE91MWmBOm2bIBl+dU6MLEnPK bZGTxgMSE7iouap3bsO/ul+uwnAAXsc5VoIaUE/CaWejhmqCa05P+eoLYJfCeu6dBP IDljcO4yoJbCsSBaGmpnoj8uCuA0BBWm6OncjhkM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 3BDED394B003 for ; Fri, 13 Mar 2020 19:07:05 +0000 (GMT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-152-pTlaCP5uNjmYfCG4wnc_9w-1; Fri, 13 Mar 2020 15:06:54 -0400 X-MC-Unique: pTlaCP5uNjmYfCG4wnc_9w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 193026A6 for ; Fri, 13 Mar 2020 19:06:53 +0000 (UTC) Received: from [10.10.123.217] (ovpn-123-217.rdu2.redhat.com [10.10.123.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id C581E388 for ; Fri, 13 Mar 2020 19:06:52 +0000 (UTC) To: "gcc-patches@gcc.gnu.org" Subject: [PATCH] LRA: fix for PR92303 Message-ID: Date: Fri, 13 Mar 2020 15:06:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-25.2 required=5.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Vladimir Makarov via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: Vladimir Makarov Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The following committed patch solves https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92303   The patch was successfully bootstrapped and tested on x86-64. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d63b83194d5..4ea81e6c404 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2020-03-13 Vladimir Makarov + + PR rtl-optimization/92303 + * lra-spills.c (remove_pseudos): Try to simplify memory subreg. + 2020-03-13 Segher Boessenkool PR rtl-optimization/94148 diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index 0022611785c..01256e711bc 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -421,7 +421,16 @@ remove_pseudos (rtx *loc, rtx_insn *insn) if (*loc == NULL_RTX) return res; code = GET_CODE (*loc); - if (code == REG && (i = REGNO (*loc)) >= FIRST_PSEUDO_REGISTER + if (code == SUBREG && REG_P (SUBREG_REG (*loc))) + { + /* Try to remove memory subregs to simplify LRA job + and avoid LRA cycling in case of subreg memory reload. */ + res = remove_pseudos (&SUBREG_REG (*loc), insn); + if (GET_CODE (SUBREG_REG (*loc)) == MEM) + alter_subreg (loc, false); + return res; + } + else if (code == REG && (i = REGNO (*loc)) >= FIRST_PSEUDO_REGISTER && lra_get_regno_hard_regno (i) < 0 /* We do not want to assign memory for former scratches because it might result in an address reload for some targets. In