From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by sourceware.org (Postfix) with ESMTPS id 9D1A53858D28 for ; Wed, 26 Apr 2023 02:30:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D1A53858D28 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-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-24735727c83so4591472a91.3 for ; Tue, 25 Apr 2023 19:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682476251; x=1685068251; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Sh8oUMng+yD8kNirgSja+Ci60MegnQNeH4BB6MNBrD0=; b=Tf0C7zl7FISC9esgF8RytPgi1KrHdT2slan5XF2jEzS2KRg6ESj0DpFuUGBmMbEM5e ZuGSQKMkKz6j4X9LmVocZ1a09C6NHtUC4/A1gh0EivQaqYQHuqIBWQW0fwLQQ18OElNq BkE+euNdt1Y513dqv8KY8jGmJf/c77itfwltNYX3XZsBOR1aHeDlRYJxj9eO4YTslJRK lMiagadTxi/9lQ0xp0DaMx+K+quW1SoCl/sAJmJkWuqa3x8w6VVfgb1zM35sDAFBYEgh RjCqVTSK9/HcoJe57t4prkn7QOUiYsyQRYVx9a3auDUBELQwjD+n/f/kZJ0Ull+1sPWq 2+7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682476251; x=1685068251; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Sh8oUMng+yD8kNirgSja+Ci60MegnQNeH4BB6MNBrD0=; b=cpdxgx3XYQFGDBuwuDMKGO4eYZAU3RNASLJuzCKaYNq9fe7BTYqMa0zdIoJ5GWdSIi PFGUIlgKvn9P0Q80UQuL4PVG8nEQxyi4qVsM/0VWwG/uAQQLJmoFSB+7wuHTeTS177H+ Ff1Yak1THW1yGSNq5G8Lx1PgZEHKwCCCzCxQnOO/cb7/pzSL028jxDzPrqJy5TugMAkb xx9SmVyEERlH2Mtb9rd3KFKTOehhxYHWmamZgbQ97uzA1XNdxTKJvyebBOKxqbQLJ7Oy b/VGwbvoJCkgqL8/kUjm2hoOdpzleJ2N7omI7vjhHP8E6UI7ChhrL0Ga/wNWMLWkRKw4 rK4g== X-Gm-Message-State: AAQBX9ceh6ubez3TWDW+uEbtmuJxDAWi+at1rQrgOpHr4I10DnXt3Xhw BNWdtpAZO9PcWf5EE9PweXc= X-Google-Smtp-Source: AKy350bkf5RYmJ2FpHAkxvSzPLdvaPa9f5pKCZvNB6xf2r7zN9dUWzfVZmHn9vBNjBJ9/4o09ilfKA== X-Received: by 2002:a17:90a:f696:b0:249:6050:d7ef with SMTP id cl22-20020a17090af69600b002496050d7efmr18855934pjb.34.1682476251383; Tue, 25 Apr 2023 19:30:51 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::99f? ([2601:681:8600:13d0::99f]) by smtp.gmail.com with ESMTPSA id lx3-20020a17090b4b0300b00246cc751c6bsm10386542pjb.46.2023.04.25.19.30.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Apr 2023 19:30:50 -0700 (PDT) Message-ID: Date: Tue, 25 Apr 2023 20:30:49 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v1] [RFC] Improve folding for comparisons with zero in tree-ssa-forwprop. Content-Language: en-US To: Richard Biener Cc: Philipp Tomsich , Manolis Tsamis , Andrew MacLeod , gcc-patches@gcc.gnu.org References: <20230316152706.2214124-1-manolis.tsamis@vrull.eu> <8bd8b246-a252-0e05-414c-ab1e35975aea@gmail.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,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 4/25/23 01:21, Richard Biener wrote: > On Tue, Apr 25, 2023 at 1:05 AM Jeff Law wrote >> >> >> >> >> On 4/24/23 02:06, Richard Biener via Gcc-patches wrote: >>> On Fri, Apr 21, 2023 at 11:01 PM 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 would >> 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. jeff