From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 39C5B3858C20 for ; Tue, 16 Aug 2022 11:38:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39C5B3858C20 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 08D0B371EA; Tue, 16 Aug 2022 11:38:04 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C5D112C149; Tue, 16 Aug 2022 11:38:03 +0000 (UTC) Date: Tue, 16 Aug 2022 11:38:03 +0000 (UTC) From: Richard Biener To: Aldy Hernandez cc: Andrew MacLeod , gcc-patches Subject: Re: [PATCH] Tame path_range_query::compute_imports In-Reply-To: Message-ID: References: <73820.122081107421800679@us-mta-533.us.mimecast.lan> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2022 11:38:08 -0000 On Tue, 16 Aug 2022, Aldy Hernandez wrote: > On Mon, Aug 15, 2022 at 11:53 AM Richard Biener wrote: > > > > The remaining issue I have with the path_range_query is that > > we re-use the same instance in the back threader but the > > class doesn't provide any way to "restart", aka give m_path > > a lifetime. The "start a new path" API seems to essentially > > be compute_ranges (), but there's no convenient way to end. > > It might be more appropriate to re-instantiate the path_range_query, > > though that comes at a cost. Or abstract an actual query, like > > adding a > > Yes, compute_ranges() is the way to start a new path. It resets exit > dependencies, the path, relations, etc. I think it would be clearer > to name it set_path (or reset_path if we want to share nomenclature > with the path_oracle). > > Instantiating a new path_range_query per path is fine, as long as you > allocate the ranger it uses yourself, instead of letting > path_range_query allocate it. Instantiating a new ranger does have a > cost, and it's best to let path_range_query re-use a ranger from path > to path. This is why path_range_query is (class) global in the > backwards threader. Andrew mentioned last year making the ranger > start-up 0-cost, but it still leaves the internal caching the ranger > will do from path to path (well, the stuff outside the current path, > cause the stuff inside the path is irrelevant since it'll get > recalculated). > > However, why can't you use compute_ranges (or whatever we rename it to ;-))?? I've added auto_bb_flag m_on_path; to the path query and at set_path time set m_on_path on each BB so the m_path->contains () linear walks go away. But I need to clear the flag for which I would need something like finish_path (), doing it just at the point we deallocate the path query object or when we set the next path via compute_ranges doesn't look right (and in fact it doesn't work out-of-the-box without adjusting the lifetime of the path query object). So a more incremental thing would be to add such finish_path () or to make the whole path query object single-shot, thus remove compute_ranges and instead use the CTOR for this. Probably not too important (for short paths). Richard. > Aldy > > > > > query start (const vec &); > > > > and make range_of_* and friends members of a new 'query' class > > instantiated by path_range_query. I ran into this when trying > > to axe the linear array walks for the .contains() query on the > > path where I need a convenient way to "clenanup" after a path > > query is done. > > > > Richard. > >