From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk1-xa30.google.com (mail-vk1-xa30.google.com [IPv6:2607:f8b0:4864:20::a30]) by sourceware.org (Postfix) with ESMTPS id 7494D3858D20 for ; Wed, 12 Jul 2023 09:09:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7494D3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-vk1-xa30.google.com with SMTP id 71dfb90a1353d-47e06acce3bso2411177e0c.2 for ; Wed, 12 Jul 2023 02:09:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1689152971; x=1691744971; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6InCernuwyoAY5rJIDc8fpC8pF0LRgSh556YjyrDQtI=; b=HcZkdgs6WLGopA1znMJoYkAiubzsv3pRhP2HVChIIxkzE2hD/33opBEOYTow8Hcicg iLsAdSoi78S6uwxL/4BntUCEz4w3kgLG4eoPT2+yIVbosUiZCkYh2kUu+wERLkNfeyM/ W/qEPwTf0dRUddzjgfDljP2GWw8RDdt9A28aQwo14geQifvdWmbWz5P18CSqHxbRlsTw Rp/CPbVVG+X0mOiATvpUiwuit8JU7BZZ5yRlqEKllDXbAff8W/HNl9rT6Q9JWWuI2LRo pxObkMhBJIO4oAFhJ1s16D9YzPm1vWr+a+axo84P/FeSicPmi55VI9Af54KuSW/ZdyME 0Yuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689152971; x=1691744971; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6InCernuwyoAY5rJIDc8fpC8pF0LRgSh556YjyrDQtI=; b=VH7Mn7ws+Zvw9L2svT6awbQTyU+xWkBoRdd4vrVpVGxyMqMgyfhfVLsVAw6nu4iI0P g17DBBQY0fVze5z588h9auYt5mFBy/BU2TGGKI5G2xmHMtF4KPSnK4+Thu8CB+EIclQe ycWX0Q8C5cur/M8lcnYOWJRnqIlWlEwD4dB6tKfMAfcktYZ6PP1ffM8lf0iGiTQyDyy7 IgNFyvaw2xu+MnsDvPABnzZFXnDZjaGzyoOeU+ve8OttjPCXsTDRAhYUQMlUcpbWm6wV M8IbgA657xylVKZagSS2X+EJ6jnTM8Fi5zs0lHDjzKpQmllFHnnBCk/lmGDtJEAYNiFt US8g== X-Gm-Message-State: ABy/qLa7IEDwy2hsCPaMRj8oMntlJdaRzPPuktH9hqS8ydO+ABwPNcOy mL4C7nvxj50AVFcsQXfFOA60y38r1DV8+7cYRWdL6Q== X-Google-Smtp-Source: APBJJlHynTWW+d+bl1OSeM2yVfxL5/9rn3LphYVPjL7lRqrHspGZQuaAGC2uOQxoDJF3ZA0PLKhT/r2z3QDPboH2p/c= X-Received: by 2002:a1f:cec7:0:b0:47e:3bac:cde4 with SMTP id e190-20020a1fcec7000000b0047e3baccde4mr8288515vkg.14.1689152971452; Wed, 12 Jul 2023 02:09:31 -0700 (PDT) MIME-Version: 1.0 References: <20230615172817.3587006-1-manolis.tsamis@vrull.eu> In-Reply-To: From: Manolis Tsamis Date: Wed, 12 Jul 2023 12:08:55 +0300 Message-ID: Subject: Re: [PATCH v2] Implement new RTL optimizations pass: fold-mem-offsets. To: Hans-Peter Nilsson Cc: gcc-patches@gcc.gnu.org, Richard Biener , Philipp Tomsich , Jeff Law Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Jul 10, 2023 at 12:37=E2=80=AFAM Hans-Peter Nilsson wrote: > > On Thu, 15 Jun 2023, Manolis Tsamis wrote: > > > This is a new RTL pass that tries to optimize memory offset calculation= s > > by moving them from add immediate instructions to the memory loads/stor= es. > > For example it can transform this: > > > > addi t4,sp,16 > > add t2,a6,t4 > > shl t3,t2,1 > > ld a2,0(t3) > > addi a2,1 > > sd a2,8(t2) > > > > into the following (one instruction less): > > > > add t2,a6,sp > > shl t3,t2,1 > > ld a2,32(t3) > > addi a2,1 > > sd a2,24(t2) > > > > Although there are places where this is done already, this pass is more > > powerful and can handle the more difficult cases that are currently not > > optimized. Also, it runs late enough and can optimize away unnecessary > > stack pointer calculations. > > It punts on all "use" insns that are not SET. > Why not use single_set there too? > The issue was that single_set will potentially discard clobbers, but if we have any clobbers it may be invalid to propagate through that instruction. Rejecting anything that is not a SET is enough to handle anything strange. Although this can be improved (look through clobbers/use?) the implementation will be more complicated without any obvious (large) benefit. Manolis > brgds, H-P