From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id C04D9385828D for ; Fri, 3 Feb 2023 18:47:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C04D9385828D 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-ed1-x530.google.com with SMTP id fi26so6077172edb.7 for ; Fri, 03 Feb 2023 10:47:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=+1Gjoy5eFKbe99W1aO3nMucKOHZaziOaIKUvxAbyIZ8=; b=SHculCuAc1j5F/n93VPRvt+wOI03Y3M8FY7omLwCEauO1RdNoqhLSA8dfJmO4tiM4Z sPEcSC+h4stftvHjJNGwhQMQHrwW4huzek00XSi9Ral/6SMLmoteGUofy5jEFaVahktO s2QZPLrVCCMpTqCTHqBaw9oHeTJ6lxewzukt9CSGU7OcN/aA0Tln5ZwTQlvA3KxC+gZM qT73BDBxYIikj/jeK2P40JXV36y9Nv/RiB7Hkqh5Yr3APobBMgfL8W/wQjoCBjK+NXbM kqSzvetOrL7IAnSMKm75lRLGnoFtduzjp6ZJ8OidfVZdN673N8bW98qpgX55La83fGXr PepA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+1Gjoy5eFKbe99W1aO3nMucKOHZaziOaIKUvxAbyIZ8=; b=2xuOhdEsTV+EJTc5zjPLjfDlVdPkHTWYB2d+7Zel4p/jkFrufEb700DBoJQzh3S8vG 6zNMqda6C6ft27XAVrSTTL+RBOXwNjm3Hn+n5hKXXWb36HKULDcNLDOMSJOFl6bDjDSx 6/rRrI+gVD9v8rdKDQPtrOJdqW6JbQ3LTdVYyEsTwt8xJXkYIezawAc52KDMy81sTIW7 XN2www1rGf0OGeBSkZ3/KGQgwMAhgsvQKRrAfpR2dllZeJmfDR10+CMrNw/XAsac8ob6 eDozjXooQyne779f0sYXv2y57ss5PZN+oFUHQ8SXsWQgWzCOZvMCaSvvNRA9nMz0k/0G hgcw== X-Gm-Message-State: AO0yUKUuFw9Y2L/x54zaMsz0r/6w/XN8CexP4Xu98CfMIDRSZQ38j7oL 3f30eUlcVCE6EcPm7bjnCdDaVQNb8gw= X-Google-Smtp-Source: AK7set99uiUPzWjGW4se/Ih56LaQ2mCE8kFqsHwD8MoUuil+uHMdpIpte+AxMeupcuFXgVP4fkvbUQ== X-Received: by 2002:a50:d61e:0:b0:46b:34a:3945 with SMTP id x30-20020a50d61e000000b0046b034a3945mr11765931edi.31.1675450042582; Fri, 03 Feb 2023 10:47:22 -0800 (PST) Received: from smtpclient.apple (dynamic-095-118-107-213.95.118.pool.telefonica.de. [95.118.107.213]) by smtp.gmail.com with ESMTPSA id c20-20020a05640227d400b004610899742asm1515033ede.13.2023.02.03.10.47.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Feb 2023 10:47:21 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] PR tree-optimization/107570 - Reset SCEV after folding in VRP. Date: Fri, 3 Feb 2023 19:47:11 +0100 Message-Id: <72247AF8-7EF8-4D7E-B914-9A1E6C4E0029@gmail.com> References: Cc: gcc-patches , "hernandez, aldy" In-Reply-To: To: Andrew MacLeod X-Mailer: iPhone Mail (20D47) X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Am 03.02.2023 um 16:54 schrieb Andrew MacLeod : >=20 > =EF=BB=BF >> On 2/2/23 07:22, Richard Biener wrote: >>> On Wed, Feb 1, 2023 at 7:12 PM Andrew MacLeod via Gcc-patches >>> wrote: >>> We can reset SCEV after we fold, then SCEVs cache shouldn't have >>> anything in it when we go to remove ssa-names in remove_unreachable(). >>>=20 >>> We were resetting it later sometimes if we were processing the array >>> bounds warning, so I removed that call and just always reset it now. >>>=20 >>> Bootstraps on x86_64-pc-linux-gnu. Testing running. Assuming no >>> regressions, OK for trunk? >> + >> + // SCEV needs to be reset for array bounds, and we do not wish to trig= ger >> + // any SCEV lookups when removing unreachable globals, so reset it her= e. >> + scev_reset (); >>=20 >> the comment suggests that SCEV queries (aka analyze_scalar_evolution) >> won't return anything after a scev_reset (). That's not true - instead w= hat >> it does is nuke the SCEV cache. That's necessary when you >> release SSA names or alter the CFG and you want to avoid followup >> SCEV queries to pick up stale data. >>=20 >> So if remove_and_update_globals performs SCEV queries and eventually >> releases SSA names you cannot remove the second call to scev_reset. >>=20 >> But yes, it's probably substitute_and_fold_engine::substitute_and_fold >> itself that should do a >>=20 >> if (scev_initialized_p ()) >> scev_reset (); >>=20 >> possibly only in the case it released an SSA name, or removed an >> edge (but that's maybe premature optimization). >>=20 >> Richard. >>=20 >>=20 > Mmm, yeah thats not what I meant to imply. We can simply reset it before t= rying to process the unreachable globals like so. Maybe we visit the S&F en= gine next release.. It seems more intrusive than this. >=20 > How about this patch? testing underway. Lgtm Richard=20 > Andrew >=20 > <0001-Reset-SCEV-before-removing-unreachable-globals.patch>