From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id B24853858C60 for ; Thu, 2 Feb 2023 12:22:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B24853858C60 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-lj1-x22d.google.com with SMTP id d8so1673524ljq.9 for ; Thu, 02 Feb 2023 04:22: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=6pCVZK9EghSvkPsO9+JovT/yig0qIjfWRzLcBzL4xUk=; b=fCsV0Qwo+tP5QLroZNISISaixUa7fu0i5moRsnmy/MlFF4zraaNUKpFPx6gEjl6OYd 6ZgR4I/jBlqirPFQ4We+uMepns+e2APLM8q5DzMEjf6OGwSN1zfYRhaaHpweE+pJNKnW qEt/zvUmVuPjjAjui3T+EYrxCoStaB2kzv5EF5As5kmcv2FM1mAp23dC85tpOEkus3Ph Lvj/sGTGZ1fEnPRoZnoaSMVI0MlSdDXlvbGOxCBlM58DyI2QzIOx5NBqmGPMifNsC8L9 N6IcQ2CFDzFZV2+YpNs5Vv+/kz3edcgbKd24baMEsd6HrEpRwLI9Emi1BzzvkFmkXTaq hTMQ== 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=6pCVZK9EghSvkPsO9+JovT/yig0qIjfWRzLcBzL4xUk=; b=XACIMKbs2zfIMIQczJckvmHDN6l/pW4C4FBzKtUNgu0qhffgJVMRGSTzrCkIY4AqCB q5u5oqVs/oTuCVtzBcBh48xpUCD1U193Rq8JMxLrTvqQApanfoovoaH3xZ06OyljbXxi wTZhde6ntYhtOnZDIfWDQ1T90neuSyF2WfYzW1Jw20l4SLAvKh8JhDa6g1cMDoaeIhmJ f5Qa9Rp0RaAn3uPMt1uLBk7B9byb2YmOICJdjkzIBuA7Hg3vgh4MdXzqh4ZE5NA0Zr7P CPfdC5A9Uck2W1L9RlNPFC4mp3HPQMW2yRnmzmUrksCMV1sbwQkRjOcYc9nJpezJXFN4 1u6w== X-Gm-Message-State: AO0yUKU8XNZEoa5CR1dYcLZsg3Bq3O59CFoZe4jHSZ7951a/AEoaZNTX GuNGEekTJwAVbLZnWRpNwMDx+UKFSvztD2GT/H0= X-Google-Smtp-Source: AK7set8LCmv+Jl4I5HmjS9Air/wtu7kmUfoRoXqiz798QOiK+ghSqnfGh+UpuOKTXBqKQ8Hkft9vghWHtrPQtd77yj8= X-Received: by 2002:a2e:b5ac:0:b0:28b:795c:51f8 with SMTP id f12-20020a2eb5ac000000b0028b795c51f8mr906924ljn.98.1675340568911; Thu, 02 Feb 2023 04:22:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Thu, 2 Feb 2023 13:22:35 +0100 Message-ID: Subject: Re: [PATCH] PR tree-optimization/107570 - Reset SCEV after folding in VRP. To: Andrew MacLeod Cc: gcc-patches , "hernandez, aldy" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.3 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 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(). > > 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. > > 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 trigger + // any SCEV lookups when removing unreachable globals, so reset it here. + scev_reset (); the comment suggests that SCEV queries (aka analyze_scalar_evolution) won't return anything after a scev_reset (). That's not true - instead what 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. So if remove_and_update_globals performs SCEV queries and eventually releases SSA names you cannot remove the second call to scev_reset. But yes, it's probably substitute_and_fold_engine::substitute_and_fold itself that should do a if (scev_initialized_p ()) scev_reset (); possibly only in the case it released an SSA name, or removed an edge (but that's maybe premature optimization). Richard. > > Andrew