From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 94FB03858C20 for ; Tue, 16 Aug 2022 08:32:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 94FB03858C20 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 7175F34061; Tue, 16 Aug 2022 08:32:07 +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 540202C143; Tue, 16 Aug 2022 08:32:07 +0000 (UTC) Date: Tue, 16 Aug 2022 08:32:07 +0000 (UTC) From: Richard Biener To: Aldy Hernandez cc: gcc-patches , "MacLeod, Andrew" 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 08:32:13 -0000 On Tue, 16 Aug 2022, Aldy Hernandez wrote: > On Thu, Aug 11, 2022 at 1:42 PM Richard Biener wrote: > > > @@ -599,6 +592,30 @@ path_range_query::compute_imports (bitmap imports, const vec &path) > > worklist.safe_push (arg); > > } > > } > > + else if (gassign *ass = dyn_cast (def_stmt)) > > + { > > + tree ssa[3]; > > + if (range_op_handler (ass)) > > + { > > + ssa[0] = gimple_range_ssa_p (gimple_range_operand1 (ass)); > > + ssa[1] = gimple_range_ssa_p (gimple_range_operand2 (ass)); > > + ssa[2] = NULL_TREE; > > + } > > + else if (gimple_assign_rhs_code (ass) == COND_EXPR) > > + { > > + ssa[0] = gimple_range_ssa_p (gimple_assign_rhs1 (ass)); > > + ssa[1] = gimple_range_ssa_p (gimple_assign_rhs2 (ass)); > > + ssa[2] = gimple_range_ssa_p (gimple_assign_rhs3 (ass)); > > + } > > + else > > + continue; > > + for (unsigned j = 0; j < 3; ++j) > > + { > > + tree rhs = ssa[j]; > > + if (rhs && add_to_imports (rhs, imports)) > > + worklist.safe_push (rhs); > > + } > > + } > > We seem to have 3 copies of this copy now: this one, the > threadbackward one, and the original one. > > Could we abstract this somehow? I've thought about this but didn't find any good solution since the use of the operands is always a bit different. But I was wondering why/if the COND_EXPR special-casing is necessary, that is, why don't we have a range_op_handler for it and if we don't why do we care about it? Richard.