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 EE5EA3858403 for ; Tue, 16 Aug 2022 12:18:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EE5EA3858403 Received: from mail-oa1-f72.google.com (mail-oa1-f72.google.com [209.85.160.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-531-0_N55RViO2O_o9Fts3Jy_Q-1; Tue, 16 Aug 2022 08:18:10 -0400 X-MC-Unique: 0_N55RViO2O_o9Fts3Jy_Q-1 Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-10ecd047e39so2516859fac.5 for ; Tue, 16 Aug 2022 05:18:10 -0700 (PDT) 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; bh=moCUCCcFs8NdGTo7+DghCwVyKME42sewtLXEbwaw0iE=; b=VU/9i7XWSviQGry4Y8y2B1ZLZKxMUnjHnz4SlJbX+XMD06hH+SBTQICQW/h7r7/TNB NLVVM+Pl/Bocf+/D2yiaU6BJeJvWSMTfTFowv84/drZRM3kGbxFFcrIPDaW4WOH+g4uk PUmnVQ6b2WKqHqnbJdjXD6l5ooiBm5iakd8xvGSggbFtzPAoxS+skWlE2L6b6NA0tpf1 AsWNrGs/I3lgm8m5Ut3elBhCbB3QLAjrV+kHjO5U5Qv46DhXGRxPp5mR0AXczzk6dOd+ /pRSTNGxR/ZwLcina7M48FSDXrLqn5BKIrxxGYRzwn30LkfF3NEhifOVnk1TybmBy8UB Xkag== X-Gm-Message-State: ACgBeo0e2LXmSwFn6PfuK6QTLNq+Hf2hO1VORlsPojuacMudNKjy2bvX csbKKspFg0w3Vx5Yqd0dXYfeaxWzfKIEG9GPofJv/AgqvmevUSQC+yia0h3ySKYgvptoeL3Zw5r ZyHDpOPR6hdTEUGFL9mYZSxFaV7XNoP2+2g== X-Received: by 2002:a4a:894e:0:b0:440:b743:c7d with SMTP id g14-20020a4a894e000000b00440b7430c7dmr6287413ooi.86.1660652289774; Tue, 16 Aug 2022 05:18:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR7t8HF59M9Fmd61dMJPyh7BIzVb8x2LJcTXYB6VY1Zp1AD69tIFygmtYDOmeO2Xq5PZPhkLbKIUKVfGE3R22Qo= X-Received: by 2002:a4a:894e:0:b0:440:b743:c7d with SMTP id g14-20020a4a894e000000b00440b7430c7dmr6287403ooi.86.1660652289468; Tue, 16 Aug 2022 05:18:09 -0700 (PDT) MIME-Version: 1.0 References: <73820.122081107421800679@us-mta-533.us.mimecast.lan> In-Reply-To: From: Aldy Hernandez Date: Tue, 16 Aug 2022 14:17:58 +0200 Message-ID: Subject: Re: [PATCH] Tame path_range_query::compute_imports To: Richard Biener Cc: Andrew MacLeod , gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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 12:18:13 -0000 On Tue, Aug 16, 2022 at 1:38 PM Richard Biener wrote: > > 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). On a high level, I wonder if this matters since we don't allow long paths for other performance reasons you've already tackled. But OTOH, I've always been a little uncomfortable with contains_p linear search, so if you think this makes a difference, go right ahead :). I'm fine with either the finish_path() or the single-shot thing you speak of. Although making path query inmutable makes things cleaner in the long run. I like it! My guess is that the non-ranger instantiation penalty would be minimal. I'd even remove the default (auto-allocated) ranger from path_range_query, to make it obvious that you need to manage that yourself and avoid folks shooting themselves in the foot. Wanna have a go at it? If you'd rather not, I can work on it. Aldy