From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id 7D09B3858C5E for ; Wed, 26 Apr 2023 06:43:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7D09B3858C5E 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-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2a8baeac4d1so66006311fa.1 for ; Tue, 25 Apr 2023 23:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682491403; x=1685083403; 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=TcSbgUA6jpnTIZ563dph/Zrf/EQOPXSttYYOGtlQMbU=; b=Wa4vS0ESPlaV2q/2jhqMRIPUFLts3kM8QAaQmeH5hbIp1HUbmsM25gE0je5hMG/fE6 3MYlxAzC1h+tP5FZtbAUevnIQop73n+mlI+LyEXXFngLAsU19JqW0LS+XcQphZ528Y7W I+JWPDAiQ30xe6Soyk+sndwV6HK71kDtspqo8pEFhW5N1uTL74wooVp8kXZSCCAgtDgW +PTmvua3LqYJ2Y+6sBmxfFf15Q/mnnnFgVgsKYIqRcc/S8m3ER0kymq8r0KjoudgsS7u oP06NKJCm5Ie5JOr2d39YhU39qMHdaVg9tX9eoDuhsOr8wjq3M1/ZvHL+fROVQMA+6H8 yEeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682491403; x=1685083403; 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=TcSbgUA6jpnTIZ563dph/Zrf/EQOPXSttYYOGtlQMbU=; b=WlMPH74zGtxYqpuS/fHI5II+vPnHXZ+Rlzo5458bV6m7kuYIvg0oYMXLELSCm/P4wk PMcV/5dDPSGuRPu8R4KqQCpdufHGacoxUg1g13m7HkfW2PtzdY92q6V0LQczse10SGLR xprvbCYPF4tR2ILDQCUnyOFB69jkfClmoaxLbeF7Y3knFd8vuyzGhmbzSBbh9L2oQhGS rWPtH0EhfLZh5fhJ7PNTNoWjNsEakrfR2C5sMEf1WYclZYWVa/ToL51k/B4rrGQoXbhi +GiO14S1R9mjwXd9pomJJ+cnbWAsKsXkHrNr2g+qwZciIj0EixuL8wP86hQk2I8VnZtV mwEA== X-Gm-Message-State: AAQBX9efVi1gWDLJhVrr7kGcJnEf+lD0SVEfnMxIGM1IIXxtgEygc040 r4cmjBotg3lbR63xvksGDf5KoCdzmsVHnXYPSrY= X-Google-Smtp-Source: AKy350ZV0I5WZy+tP5PwAJQGJ/4FwRvLQPyv4yP8wVBy9z5onDWemPVAdDfMdR86uxu4npvkeFVyLq5N5TjJCeVA+LY= X-Received: by 2002:a2e:b0e4:0:b0:2a7:b165:7db3 with SMTP id h4-20020a2eb0e4000000b002a7b1657db3mr4143158ljl.21.1682491402759; Tue, 25 Apr 2023 23:43:22 -0700 (PDT) MIME-Version: 1.0 References: <20230316152706.2214124-1-manolis.tsamis@vrull.eu> <8bd8b246-a252-0e05-414c-ab1e35975aea@gmail.com> In-Reply-To: From: Richard Biener Date: Wed, 26 Apr 2023 08:41:54 +0200 Message-ID: Subject: Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop. To: Jeff Law Cc: Philipp Tomsich , Manolis Tsamis , Andrew MacLeod , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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: On Wed, Apr 26, 2023 at 4:30=E2=80=AFAM Jeff Law wr= ote: > > > > On 4/25/23 01:21, Richard Biener wrote: > > On Tue, Apr 25, 2023 at 1:05=E2=80=AFAM Jeff Law wrote > >> > >> > >> > >> > >> On 4/24/23 02:06, Richard Biener via Gcc-patches wrote: > >>> On Fri, Apr 21, 2023 at 11:01=E2=80=AFPM Philipp Tomsich > >>> wrote: > >>>> > >>>> Any guidance on the next steps for this patch? > >>> > >>> I think we want to perform this transform later, in particular when > >>> the test is a loop exit test we do not want to do it as it prevents > >>> coalescing of the IV on the backedge at out-of-SSA time. > >>> > >>> That means doing the transform in folding and/or before inlining > >>> (the test could become a loop exit test) would be a no-go. In fact > >>> for SSA coalescing we'd want the reverse transform in some cases, see > >>> PRs 86270 and 70359. > >>> > >>> If we can reliably undo for the loop case I suppose we can do the > >>> canonicalization to compare against zero. In any case please split > >>> up the patch (note > >> I've also > >>> hoped we could eventually get rid of that part of > >>> tree-ssa-forwprop.cc > >> in favor > >>> of match.pd patterns since it uses GENERIC folding :/). > >>> > >> Do we have enough information to do this at expansion time? That woul= d > >> avoid introducing the target dependencies to drive this in gimple. > > > > I think so, but there isn't any convenient place to do this I think. I= suppose > > there's no hope to catch it during RTL opts? > Combine would be the most natural place in the RTL pipeline, but it'd be > a 2->2 combination which would be rejected. > > We could possibly do it as a define_insn_and_split, but the gimple->RTL > interface seems like a better fit to me. If TER has done its job, we > should see a complex enough tree node to do the right thing. Of course we'd want to get rid of TER in favor of ISEL Richard. > jeff