From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 7A52F3858D35 for ; Thu, 30 Mar 2023 22:59:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7A52F3858D35 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-pf1-x42e.google.com with SMTP id bt19so13659841pfb.3 for ; Thu, 30 Mar 2023 15:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680217150; 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=nIIi7GVSuwqW/O4MtkJz+uaY0uDXEhWyO2D8UKZ8660=; b=AMFNZE+futs32AW/iqzrWnaOFIvVkcmk++K/j5voTOFqdU4rPGbFT34mvDq2DbD1Qj GU5GKYnbYpdXj5NroG+Gl/R5UudOuTowpH9BIVhseCtyjL4Rp05Bi6uqei1gvKDHgEkt QGBt1CNqbzdhSOCVThYPa+0AKcHDTD57Thtoajx4i3+fqlPxEWfn04bV2O2tT5OTeu3y KD5qMWW0q7NDiCMDNUcNlxc4xY0tMcuRnOD5d/pgHE0fNt7g68iqtQpIGsyXXi/Iykv4 9j6/TQKFeHygaW/tuQXZ6RpdwA+9i6AGA18S0x1qvZzacyGh7ZBAXVQfwxau3pUOfA+K GPrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680217150; 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=nIIi7GVSuwqW/O4MtkJz+uaY0uDXEhWyO2D8UKZ8660=; b=S8Ju3XnBfM/Oxh6LAtR7T0XAFS/0iWFdO/WpnMSPNphvQshYXDRt1qWX7eLBYeVtxw AwZx14UCoJLMzMW/PcJG3ylwimq/iTe9NdbsrcYKD9BcvaXZQYy/WaWTKlGsBy4zp6/6 xuMDXL86TQWm+Xurht7TB+HVhhOX96JcxS+X7ftorihH//KQANl7UJTYDVdUMGXE+5OQ HgK3d1GfXOiN1PjrT/1rEPEWwiiCR7lpbUvlNzXGDKNYDF5k6sDh3QDf27Q8E0cPGX+o yjekzBHf15DIfxgw9vGSEdd02hXoHkQ6ucCjabshfUSxuJ+LRywKWBxnxEfkdnh7ZKW4 8B8g== X-Gm-Message-State: AAQBX9c044Dn4PQR+5sGLSBL1qRxCuX35iJC0mpQ3ouC2Cg4lQLZ8c+N 3+2AKrkz4he/7nOHJs3I0GfVicoLFqvaTM5F6ms= X-Google-Smtp-Source: AKy350aul4G/5a3pg2QkFCXGR/cMlLBteEVDHTkGUj1BcimtDNNeSjPxW7Mibec5LpVCydsVolGzxtCWI7GGMTcIw/Y= X-Received: by 2002:a05:6a00:1804:b0:62b:f8e9:2a17 with SMTP id y4-20020a056a00180400b0062bf8e92a17mr11952178pfa.3.1680217150201; Thu, 30 Mar 2023 15:59:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrew Pinski Date: Thu, 30 Mar 2023 15:58:58 -0700 Message-ID: Subject: Re: [PATCH]middle-end Guard value_replacement and store_elim from seeing diamonds. To: Tamar Christina Cc: gcc-patches@gcc.gnu.org, nd@arm.com, rguenther@suse.de Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.3 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, Aug 5, 2022 at 6:16=E2=80=AFAM Tamar Christina via Gcc-patches wrote: > > Hi All, > > This excludes value_replacement and store_elim from diamonds as they don'= t > handle the form properly. > > Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu > and no issues. > > Ok for master? I just noticed this changes the behavior of the store elimination pass to also act like phi-opt if bb layout was a diamond. I will be submitting a patch for GCC 14 to revert back that behavior with some refactoring I am doing to improve the readability of the code. Thanks, Andrew Pinski > > Thanks, > Tamar > > gcc/ChangeLog: > > PR middle-end/106534 > * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Guard the > value_replacement and store_elim from diamonds. > > --- inline copy of patch -- > diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc > index bdbf52916b0f88ee4f475e1fa306046d61f13d53..1e002c608591836ffb001724b= 3f469a8d042ae5e 100644 > --- a/gcc/tree-ssa-phiopt.cc > +++ b/gcc/tree-ssa-phiopt.cc > @@ -283,7 +283,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_h= oist_loads, bool early_p) > || (e1->flags & EDGE_FALLTHRU) =3D=3D 0) > continue; > > - if (do_store_elim) > + if (do_store_elim && !diamond_p) > { > /* Also make sure that bb1 only have one predecessor and that i= t > is bb. */ > @@ -310,7 +310,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_h= oist_loads, bool early_p) > > /* Value replacement can work with more than one PHI > so try that first. */ > - if (!early_p) > + if (!early_p && !diamond_p) > for (gsi =3D gsi_start (phis); !gsi_end_p (gsi); gsi_next (&g= si)) > { > phi =3D as_a (gsi_stmt (gsi)); > > > > > --