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 A3EEF3858C20 for ; Tue, 16 Aug 2022 09:15:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A3EEF3858C20 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-387-NquDIfxhP3u6VZt81kG0Xg-1; Tue, 16 Aug 2022 05:15:30 -0400 X-MC-Unique: NquDIfxhP3u6VZt81kG0Xg-1 Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-10e715ad38aso2375662fac.17 for ; Tue, 16 Aug 2022 02:15:29 -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=p7M+ExNXnXKWuAN58NEsdumaRTValeBTN6jHaRNdqAs=; b=jR8PK6UC1QlKcB0MPjujxgdawlKt/hftVDj2FUyWzEWOiP9+8sNBm4whXN2Zni7+xj UPGb7UqXjtNzst2y4CAgFChXjqxNm11Y71u5npWanV5ZOKRAkYxwZaU//ldv0hf0fmWw Hif5YTvxiJW6cY9eAMERBrfc1C/n9f3NVLbBUvr8YWlkNtDFYoPqs0Bb+glA49020uPs NGEGxqFf+saO0Fv3U6MZ+A4AkVJ8hlUjYXe4Cr9qcuZJjsMZF/ada/ZiTkhJJ4yIAZ4W WchGF5e13wsqKEkxqOOAg6fATvqoAxiJhWCKB6RzLLVgmk/S/hJMuiuYqqzsY244Nfhf wLIQ== X-Gm-Message-State: ACgBeo3N7rqIA0+27glMuEcZ0zG2prJWAOc1atgANf0rdf9ydALXQB+k gHwFWMzmGJdp1nNpXUJtwRxqn/vWU3/BVlKpIK6D2SZs7xOcS4KSwM/TMAaRleVEwdxztm73Sc8 4wU4WOkabMpHQJfjKElt1qeJWbSAVsc7QMA== X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr5919713oiw.265.1660641329348; Tue, 16 Aug 2022 02:15:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6hAVmGuFv4T/9eJ0twHQuml7qIT5TEVZ4ZwhGJ0Od7KHEXP8DH9pbCbY/QyYvWcGX6gtDwgvgFb1dpFMB9zyY= X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr5919706oiw.265.1660641329119; Tue, 16 Aug 2022 02:15:29 -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 11:15:18 +0200 Message-ID: Subject: Re: [PATCH] Tame path_range_query::compute_imports To: Richard Biener Cc: gcc-patches , "MacLeod, Andrew" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.1 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 09:15:33 -0000 On Tue, Aug 16, 2022 at 11:08 AM Aldy Hernandez wrote: > > On Tue, Aug 16, 2022 at 10:32 AM Richard Biener wrote: > > > > 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? > > I think it's because we don't have a range-op handler for COND_EXPR, > opting to handle the relational operators instead in range-ops. We > have similar code in the folder: > > if (range_op_handler (s)) > res = range_of_range_op (r, s, src); > else if (is_a(s)) > res = range_of_phi (r, as_a (s), src); > else if (is_a(s)) > res = range_of_call (r, as_a (s), src); > else if (is_a (s) && gimple_assign_rhs_code (s) == COND_EXPR) > res = range_of_cond_expr (r, as_a (s), src); > > Andrew, do you have any suggestions here? Hmmm, so thinking about this, perhaps special casing it is the way to go ??