From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 54BAF3858C78 for ; Fri, 17 Feb 2023 07:54:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 54BAF3858C78 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-lf1-x135.google.com with SMTP id d28so621623lfv.13 for ; Thu, 16 Feb 2023 23:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=GZmOEdzoAjrB+jlXsWjUr76uZST7OVMY59mSPe4GUXg=; b=Q/6e/OQvHmAQmspA6O2eXB568oBHA+jRketCBDFr5M9CPTvVD4tGTitv2wEVPh59+6 A5qcxkZjgbpt5fIPrK5Opaw5o3JiPWw8eAXQW/UKhZRgHxwQVXk6VoNnA76FeGQrLcc+ +TID3Y8cOVfTeckZZC7ZZqUpckLpcc3O653Dw0oYwExw7N6x67PRQfWxrE4EVElxrEve WVzg9d4dyKX/whlwdl7P5cCYonTgsPRGc0f9hDK1Kyam9OaCUqJ2Oam9OdE32uOgDwkO GbqpQ4m+3iWS2F9csKAUD1kvw3cLYHmGs/AzeUlqwFKhc2Ke+Rjo/jX3fyeY6tt/Xj9g uACQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=GZmOEdzoAjrB+jlXsWjUr76uZST7OVMY59mSPe4GUXg=; b=M2dRD9/LBVxpIteeCeXBajxFl7bLZO3lHFS7BeDZXJmNypGzo8qFw4mfVhJ8JH3d1T CvL0OB3yRPhLMjm91IZkKkfTL/wbnuz/7GxNrZLPMco0I4e7KHKW3LKix5K4Woe6CjKo 8Fr1BzC5MPx7BLyYpU3Io1Jmcnm7/XkoxLhT9BR7r7DfsxEW6n5Bkf414OhscBqiyj0t fN2qX+NS5KZl7KZ9wKZEmDur3WiiS2EDxsZxamN/GwnkCnmysfxHAlyjoZGuuimqLGIZ MXzLpG3hVJ5llp8JZiY0o9Zg9yNxVKpxHtOSNoKBForqM0x4EAb8pnXnPm97GVzqPwZR 8nxA== X-Gm-Message-State: AO0yUKWKlckBGVWxD3QgA/fVi7QM+3vL4FSAPjm6V+7N/gozPDhWi1k2 VAdIpkloDPP+pnaTaWrp5xQ9pcNxMk/i1YveJ+d8nZOP X-Google-Smtp-Source: AK7set8mTkWxCvTuGCT6NNyP29Gvbo94gFbF6itv6fbcH1pzRnDO6YqD0fQ8oCJkOdRXDL0RDi+J54AYyYmG0i09ano= X-Received: by 2002:ac2:4c2f:0:b0:4d5:ca42:aee5 with SMTP id u15-20020ac24c2f000000b004d5ca42aee5mr201016lfq.5.1676620488562; Thu, 16 Feb 2023 23:54:48 -0800 (PST) MIME-Version: 1.0 References: <86ad2755-1e70-6c19-89ed-7817d61a5053@redhat.com> In-Reply-To: From: Richard Biener Date: Fri, 17 Feb 2023 08:54:33 +0100 Message-ID: Subject: Re: [PATCH] PR tree-optimization/108697 - Create a lazy ssa_cache To: Andrew MacLeod Cc: gcc-patches , "hernandez, aldy" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.0 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 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 Thu, Feb 16, 2023 at 3:34 PM Andrew MacLeod wrote: > > > On 2/16/23 02:55, Richard Biener wrote: > > On Wed, Feb 15, 2023 at 6:07 PM Andrew MacLeod via Gcc-patches > > wrote: > >> This patch implements the suggestion that we have an alternative > >> ssa-cache which does not zero memory, and instead uses a bitmap to track > >> whether a value is currently set or not. It roughly mimics what > >> path_range_query was doing internally. > >> > >> For sparsely used cases, expecially in large programs, this is more > >> efficient. I changed path_range_query to use this, and removed it old > >> bitmap (and a hack or two around PHI calculations), and also utilized > >> this is the assume_query class. > >> > >> Performance wise, the patch doesn't affect VRP (since that still uses > >> the original version). Switching to the lazy version caused a slowdown > >> of 2.5% across VRP. > >> > >> There was a noticeable improvement elsewhere., across 230 GCC source > >> files, threading ran over 12% faster!. Overall compilation improved by > >> 0.3% Not sure it makes much difference in compiler.i, but it shouldn't > >> hurt. > >> > >> bootstraps on x86_64-pc-linux-gnu with no regressions. OK for trunk? > >> or do you want to wait for the next release... > > I see > > > > @@ -365,16 +335,8 @@ path_range_query::compute_ranges_in_phis (basic_block bb) > > > > Value_Range r (TREE_TYPE (name)); > > if (range_defined_in_block (r, name, bb)) > > - { > > - unsigned v = SSA_NAME_VERSION (name); > > - set_cache (r, name); > > - bitmap_set_bit (phi_set, v); > > - // Pretend we don't have a cache entry for this name until > > - // we're done with all PHIs. > > - bitmap_clear_bit (m_has_cache_entry, v); > > - } > > + m_cache.set_global_range (name, r); > > } > > - bitmap_ior_into (m_has_cache_entry, phi_set); > > } > > > > // Return TRUE if relations may be invalidated after crossing edge E. > > > > which I think is not correct - if we have > > > > # _1 = PHI <..., _2> > > # _2 = PHI <..., _1> > > > > then their effects are supposed to be executed in parallel, that is, > > both PHI argument _2 and _1 are supposed to see the "old" version. > > The previous code tried to make sure the range of the new _1 doesn't > > get seen when processing the argument _1 in the definition of _2. > > > > The new version drops this, possibly resulting in wrong-code. > > This is dropped because it is actually handled properly in > range_defined_in_block now. (which I think Aldy was describing). > > It didnt make sense to me why it was handled here like this, so I traced > through the call chain to find out if it was still actually needed and > discussed it with Aldy. I think it was mostly a leftover wart. Ah, thanks for checking. > > > > While I think it's appropriate to sort out compile-time issues like this > > during stage4 at least the above makes me think it should be defered > > to next stage1. > > I am happy to defer it since its a marginal increase anyway. Sure - thus OK for stage1. Thanks, Richard. > > Andrew > >