From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id 66CE93857036 for ; Tue, 25 Jul 2023 11:31:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 66CE93857036 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2+tLY0Vwvu01DULI+PgLMX4HYyB8GFFNR5jJSTxNQgo=; b=C9CWe38AMw49K44VFk6njcenKW AniiNgxOeTM5HpObAxd0eTwTdcLLmNi7hJ2ywOu0yFmdGDAvX57Ms/ymx7fNGpVOkEiVBieHmOkQF 1oliwrEREC8z5ghfCsN+Fh2I4D8zqR4LuNxm3EIgFFXFLGB7Bv6kk/gulZZWdKuL0jeaXNHEgL92Z q+1OVQk7eJNaNN/ReGoxwHxoqrQ5DdRwHqumBYBH3qul+fKyTaKvPHLecqOWIH0wSgiTjKOASfoLk oaWTOdXMHQftqa2lMornBGazSbfIdyyrSKa7qrY21t5hWuMze1L9dAziQM/8mFPWjZIZgN2ZNqrX+ OajHBUKQ==; Received: from [185.62.158.67] (port=57573 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qOGGZ-0007ac-1I; Tue, 25 Jul 2023 07:31:47 -0400 From: "Roger Sayle" To: Cc: "'Richard Biener'" Subject: [PATCH] PR rtl-optimization/110587: Reduce useless moves in compile-time hog. Date: Tue, 25 Jul 2023 12:31:45 +0100 Message-ID: <004c01d9beeb$98c6fcf0$ca54f6d0$@nextmovesoftware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_004D_01D9BEF3.FA8B64F0" X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adm+6zbWFvtJ7g2wSOqTed74IJ6CIg== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is a multipart message in MIME format. ------=_NextPart_000_004D_01D9BEF3.FA8B64F0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This patch is the third in series of fixes for PR rtl-optimization/110587, a compile-time regression with -O0, that attempts to address the underlying cause. As noted previously, the pathological test case pr28071.c contains a large number of useless register-to-register moves that can produce quadratic behaviour (in LRA). These move are generated during RTL expansion in emit_group_load_1, where the middle-end attempts to simplify the source before calling extract_bit_field. This is reasonable if the source is a complex expression (from before the tree-ssa optimizers), or a SUBREG, or a hard register, but it's not particularly useful to copy a pseudo register into a new pseudo register. This patch eliminates that redundancy. The -fdump-tree-expand for pr28071.c compiled with -O0 currently contains 777K lines, with this patch it contains 717K lines, i.e. saving about 60K lines (admittedly of debugging text output, but it makes the point). This patch has been tested on x86_64-pc-linux-gnu with make bootstrap and make -k check, both with and without --target_board=unix{-m32} with no new failures. Ok for mainline? As always, I'm happy to revert this change quickly if there's a problem, and investigate why this additional copy might (still) be needed on other non-x86 targets. 2023-07-25 Roger Sayle gcc/ChangeLog PR middle-end/28071 PR rtl-optimization/110587 * expr.cc (emit_group_load_1): Avoid copying a pseudo register into a new pseudo register, i.e. only copy hard regs into a new pseudo. Thanks in advance, Roger -- ------=_NextPart_000_004D_01D9BEF3.FA8B64F0 Content-Type: text/plain; name="patchhg3.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patchhg3.txt" diff --git a/gcc/expr.cc b/gcc/expr.cc=0A= index fff09dc..11d041b 100644=0A= --- a/gcc/expr.cc=0A= +++ b/gcc/expr.cc=0A= @@ -2622,6 +2622,7 @@ emit_group_load_1 (rtx *tmps, rtx dst, rtx = orig_src, tree type,=0A= be loaded directly into the destination. */=0A= src =3D orig_src;=0A= if (!MEM_P (orig_src)=0A= + && (!REG_P (orig_src) || HARD_REGISTER_P (orig_src))=0A= && (!CONSTANT_P (orig_src)=0A= || (GET_MODE (orig_src) !=3D mode=0A= && GET_MODE (orig_src) !=3D VOIDmode)))=0A= ------=_NextPart_000_004D_01D9BEF3.FA8B64F0--