From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0B01B3858C5F for ; Thu, 16 Feb 2023 14:34:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B01B3858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676558090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lETQrF9m0ZGFRZxKLP6gtTI71csLgl0dGoUslSe984g=; b=gRD9TCmivj3dBI3YiPX7KzyUcuMvTm/b7fWLOFVWEtvNqrGb6SpYpslrh+dJzKrg9VWEdB w2hqp6B9ZWeokMZR3lhx5v7IIKRu98URlVsL/LsVMzfRy7gkt5NvWRYMz2bnBDS8r3G0d6 D+tN48gP3Ywd9/WxpL/ZA1aSwzIXT7s= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-25-h0ibMl24OhewNyIivZbeog-1; Thu, 16 Feb 2023 09:34:49 -0500 X-MC-Unique: h0ibMl24OhewNyIivZbeog-1 Received: by mail-qt1-f199.google.com with SMTP id p6-20020a05622a048600b003b9a3ab9153so1296000qtx.8 for ; Thu, 16 Feb 2023 06:34:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=lETQrF9m0ZGFRZxKLP6gtTI71csLgl0dGoUslSe984g=; b=3FzgHrx5xe6sU1LXJTOnQMLWcLraaOLtq7qmZv/pC5JWaaGdJsDKiUq07INgOXWNVG RG+4QIEsS34Bc/L+YEXelL6km8GYBoqSTye243Pa57GNv1bkNR/VUPBW3PTCrGQycPiw 7sxcZqu7+PvonWkIWPEzJ8OV4olY7srl9bbhINblOwMxbcPXTPLDS9VOnzxOsxfH10vU BBujgb/woC5vyeIN5xlcpAgofgPFeRr8DDTZSAewpc6CPeDXJ37sNK2mfRXk/K7kESEU Pu6uh8snUEP8Fi20Dy7UAgAxOaR3fC0sks6Kefks7XhL3hHa90uZbek0tXZk9PzawKl0 n6gA== X-Gm-Message-State: AO0yUKWpIfj40mRMaTi+ZAmA9aIuwaxbxrVjKmpX/cV+UL9kkDSekBCU Apzt6z1WPJ5dKtm4YHo9wZWw7gmxr1g6IvbCZs+Hz1YJH0teaM02BXgj7N82nFnKOJ7J4YeoWpq vbdl6o4BI05DIXXS0TQ== X-Received: by 2002:ac8:59ce:0:b0:3bd:1647:1602 with SMTP id f14-20020ac859ce000000b003bd16471602mr358456qtf.8.1676558088727; Thu, 16 Feb 2023 06:34:48 -0800 (PST) X-Google-Smtp-Source: AK7set/ZAbTfhWRREWVato3WOXFbPfOJchOuVwHOkyusCzdg3ZOT1zH+WKCK6Inz+e6cT2oDCGHBoQ== X-Received: by 2002:ac8:59ce:0:b0:3bd:1647:1602 with SMTP id f14-20020ac859ce000000b003bd16471602mr358423qtf.8.1676558088460; Thu, 16 Feb 2023 06:34:48 -0800 (PST) Received: from ?IPV6:2607:fea8:a263:f600::de2a? ([2607:fea8:a263:f600::de2a]) by smtp.gmail.com with ESMTPSA id c29-20020ac8009d000000b003ba2a15f93dsm1349274qtg.26.2023.02.16.06.34.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Feb 2023 06:34:48 -0800 (PST) Message-ID: Date: Thu, 16 Feb 2023 09:34:46 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] PR tree-optimization/108697 - Create a lazy ssa_cache To: Richard Biener Cc: gcc-patches , "hernandez, aldy" References: <86ad2755-1e70-6c19-89ed-7817d61a5053@redhat.com> From: Andrew MacLeod In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 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. > > 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. Andrew