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 49A523858C5F for ; Thu, 16 Feb 2023 07:55:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49A523858C5F 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 c20so1738754lfv.6 for ; Wed, 15 Feb 2023 23:55:14 -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=cfwgOzqSsgVRlH0TJqDkna22KX8wI2kVA2Cp+kmmfsU=; b=C+kb+iAaHtX+tfxIxICFPYQ8v5JKOTkr9+IIay20hcKxXLhC23rQXYfgwiuVuPfeik zV0wJQFNorXxW0UY/yM7ajcEYB6OqlJT9hYpO4lCCWsr2rZ8SePEMWR1viD2nI9ltS4B IRsxrMg77CaXIX2f+kMTSFeW+iriSyHhg8DkP3hUfKI9Bt8XdmK2ezszOdnIP53ltCTR 1gjrAUNDDZyBYhzqeWe0ZFymo6FlWXdBAfz94DIMeN3ddPPdshpTNxhD7uzUI0eK6qML QYPljbkWyakwZlfJUQ1ZTqG8ZQGqlPgYVCVmLWZHOKVl5bcuOlJtOI/jpxgbVuyFM3N5 S0bw== 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=cfwgOzqSsgVRlH0TJqDkna22KX8wI2kVA2Cp+kmmfsU=; b=4BFaFIpGGtz0yCd8ync9HxAIpnABR+76Ec3r+D8qjQKE1tkyvGxzmT0hk49VGnJ8az ITOKlf1M/y9cS5dreiQDPYoz75e/l+C5P9uvZFf9rRCNfGpiDV3DdktYk+BvxSTcYPV3 ykRx+T6Sm54nFAUH5TZUbUQK2Kg/kadNpgYsVJIBDRLD4IaId6rCT2+uZMnUzT6e8Rjo V+5vTdogSh+ZrpZREAfEbZypTc8aV3tDMDzftC3mQeEc/dpcBZDopTsoUnZN2g73C6d+ NxTvGRwRkXvSSrcwVHClJ1fQ7c+ldRnlFqSpb7Yzxp/4QGQ7/JZeNKhrHNimbv2DYSq5 okog== X-Gm-Message-State: AO0yUKXcO7YL+Mjr7bwA7Uthgq+5j/HysHDpGnze5P+Lxu2fi0xAA4/s 0zI600yiYi/b7cVTgc8rC3Db9WdKKU9iricZ/0U= X-Google-Smtp-Source: AK7set93giBcQDt/PUg+1My76fz7Unk/biTcJ4SylFOmdUhbmX1sq0ai94hxk17MGmLGjGQuvcVCtRIUklWFdwjdLcc= X-Received: by 2002:ac2:4949:0:b0:4db:2425:5d11 with SMTP id o9-20020ac24949000000b004db24255d11mr1410510lfi.5.1676534112772; Wed, 15 Feb 2023 23:55:12 -0800 (PST) MIME-Version: 1.0 References: <86ad2755-1e70-6c19-89ed-7817d61a5053@redhat.com> In-Reply-To: <86ad2755-1e70-6c19-89ed-7817d61a5053@redhat.com> From: Richard Biener Date: Thu, 16 Feb 2023 08:55:00 +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 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. 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. Richard. > > Andrew