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.133.124]) by sourceware.org (Postfix) with ESMTPS id 40DDF3858429 for ; Tue, 16 Aug 2022 09:08:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 40DDF3858429 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-248-OPb53Cb2OmqOvFHz7rHwBw-1; Tue, 16 Aug 2022 05:08:47 -0400 X-MC-Unique: OPb53Cb2OmqOvFHz7rHwBw-1 Received: by mail-oo1-f70.google.com with SMTP id k4-20020a4a3104000000b0044607fa7d05so4820840ooa.21 for ; Tue, 16 Aug 2022 02:08:47 -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=Vkn8BLmRNmJEfpMkCtc01pZ5m2McGKtsMaV8tyOj53I=; b=HseCACiW5Tt3eLdDFMopBKZthDusIgbwvJzq7PwWEE+Rs8PROaNRFmnYbRgZYjmyQY 7LCC17luykTSS/+RGj322k3KJifXNDrCGbRsSuqFYlPKJ7p4SMmE6B9gpnelgUuLDtbU tHqhGhodp4UxQA8gnc094gr9uDz9TxXndqnecwMpZp8bVWwBRg9eb1OAoCCVPYDgdjt8 CKCFj245TRMgVhVbJEKaH3XxxoFlRepZTj+5yorivrD7ZL/QSBp7hE18jdAzE8SR+Ru7 Dn//HN+hNYdYKGFs99PZLSaFSdHTaiws1Wgd1EOHCn6mI8ECWU8K3HfINLAjqApltqFb SjlQ== X-Gm-Message-State: ACgBeo0hR/yagnl2+Zn3sDtkg0t06xHkwzUTojLmq0Qj2J0V8Z8DPQw8 nK5AWlOhPS4mK8JagruXADyh8Vw8s7GN2fyT9YtifRQw4B3BgbWfvwCax33PjcBqPsh4eU9WI+O TZNxe0xz1YlZT8yetsjO4b7qR2TUO6E4CFA== X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr5912249oiw.265.1660640927150; Tue, 16 Aug 2022 02:08:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR63wWF2PMI7xPQ5FcNfdUZhyw0l3ZL0AZKZX18xl+D1GLxKBtaccx4lL9EYnTt+vOI686egymI7kOCjLvrr62E= X-Received: by 2002:a05:6808:f07:b0:344:7739:8e7b with SMTP id m7-20020a0568080f0700b0034477398e7bmr5912244oiw.265.1660640926960; Tue, 16 Aug 2022 02:08:46 -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:08:35 +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=-5.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, 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:08:50 -0000 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? Aldy