From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 136983857B81 for ; Tue, 25 Oct 2022 11:08:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 136983857B81 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52f.google.com with SMTP id a5so22550482edb.11 for ; Tue, 25 Oct 2022 04:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=k8Vc9pNYpOERhruH407O1LLS4SB53fNRGAeYBC5+l5Q=; b=RKM+oPWZRiZiHHfzHOWQdtV7VyFCMgOTi5Pumn9Jz6Za4H/N/UpkhnBIjQ1kd863It w+WJgZ92YR/gbqAiO9GT52Gcv1qesMfZqSGrS6HCyl6NJ2CYzC9QpXh+zHTtfIRFbSCd 2gGMSzcI/KqZuQjgNB2XOEeHdGwk2cKaNv6d6BDktOpJflNIQSsVGopgg0KvGNJPMCy1 Ycw6tiuWk9NRsDB1j8jcVuSchngnIxnO/Q6vQusr1wcalWUZ0yQc1u0OWWIjVCwnyKww F/Q1MYPs/kihT2OgSdDi2tFWrGDRxlmYNnE9haFUk7hSR84dxywU+NDfUu5VcXQ6Crl/ fBDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=k8Vc9pNYpOERhruH407O1LLS4SB53fNRGAeYBC5+l5Q=; b=oQ8MCQ7rw6bf2LGAlIEmIOznsKzkWlE9bv9H0dIX0pnxdLviwKj8gkh8ELw9ffJ0Sl LHCd/TluMVDdKFw05EUsoFBrjCZrXPVymeAykXIQqCvQmZoGrhz88wYAuT7YfaC2LWHd FbvCjK0YhfiZjdJKjOXtQqhfFG3iI3/bEVdyEBo957MOx6Y3WeEUqcoAxMD9m0xkU2XT L4WZ/duVgt4FDdYeIuO29XvmSmIRcTlGl0CfhOs1hOnOPt7p8qdmbCHgPN5l5bkkjExb kXKMEvWJcQAJzO19sPqntinG1MAM1sKINMqxPLGkmmzT4oTyEpePZR3NNb9oHgjnVtzv EcPw== X-Gm-Message-State: ACrzQf0zTbGth5c+unaWUsUb3S3Z1IDxHBjJ4FzcjDTYxgDqfekaI9FK L9CqTgO8TusGFdDlKoTYQDXWfx40+m6waz0huoA= X-Google-Smtp-Source: AMsMyM5+1Tk0O2waWglpuV+e8vLj3ZQeCeOdiGjiYGcTW1P1325nFro+7gXMvtKL7znJZ/HUVD+d/uy/PECis6kypRs= X-Received: by 2002:aa7:d8c4:0:b0:461:8d31:41fc with SMTP id k4-20020aa7d8c4000000b004618d3141fcmr14108145eds.202.1666696077677; Tue, 25 Oct 2022 04:07:57 -0700 (PDT) MIME-Version: 1.0 References: <20221021135203.626255-1-dimitrije.milosevic@syrmia.com> <20221021135203.626255-3-dimitrije.milosevic@syrmia.com> In-Reply-To: <20221021135203.626255-3-dimitrije.milosevic@syrmia.com> From: Richard Biener Date: Tue, 25 Oct 2022 13:07:45 +0200 Message-ID: Subject: Re: [PATCH 2/2] ivopts: Consider number of invariants when calculating register pressure. To: Dimitrije Milosevic Cc: gcc-patches@gcc.gnu.org, djordje.todorovic@syrmia.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: On Fri, Oct 21, 2022 at 3:57 PM Dimitrije Milosevic wrote: > > From: Dimitrije Milo=C5=A1evi=C4=87 > > This patch slightly modifies register pressure model function to consider > both the number of invariants and the number of candidates, rather than > just the number of candidates. This used to be the case before c18101f. don't you add n_invs twice now given unsigned n_old =3D data->regs_used, n_new =3D n_invs + n_cands; unsigned regs_needed =3D n_new + n_old, available_regs =3D target_avail_r= egs; ? > gcc/ChangeLog: > > * tree-ssa-loop-ivopts.cc (ivopts_estimate_reg_pressure): Adjust. > > Signed-off-by: Dimitrije Milosevic > --- > gcc/tree-ssa-loop-ivopts.cc | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc > index d53ba05a4f6..9d0b669d671 100644 > --- a/gcc/tree-ssa-loop-ivopts.cc > +++ b/gcc/tree-ssa-loop-ivopts.cc > @@ -6409,9 +6409,9 @@ ivopts_estimate_reg_pressure (struct ivopts_data *d= ata, unsigned n_invs, > + target_spill_cost [speed] * (n_cands - available_regs) * 2 > + target_spill_cost [speed] * (regs_needed - n_cands); > > - /* Finally, add the number of candidates, so that we prefer eliminatin= g > - induction variables if possible. */ > - return cost + n_cands; > + /* Finally, add the number of invariants and the number of candidates, > + so that we prefer eliminating induction variables if possible. */ > + return cost + n_invs + n_cands; > } > > /* For each size of the induction variable set determine the penalty. *= / > -- > 2.25.1 >