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 DE4E23858C74 for ; Thu, 11 Aug 2022 13:11:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DE4E23858C74 Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-486-Th-9H8BbMvuc7gusf3Rqsg-1; Thu, 11 Aug 2022 09:11:52 -0400 X-MC-Unique: Th-9H8BbMvuc7gusf3Rqsg-1 Received: by mail-oi1-f200.google.com with SMTP id q4-20020a0568080ec400b00342b973d2e3so7516549oiv.11 for ; Thu, 11 Aug 2022 06:11:52 -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=JgXOxNwnVFl9tUlSPSBaSxLn/wzKYQgEYYf1p4Y4qw4=; b=UJJs+jngWq9nNEN++Vk8sPFUY4b13f3B8QV344D+eNIgmAuaxd7jIr6SZbuMMJuUWB /Wyj2Iwq0UsOFtHxtQ+0TngU2y20B5B3q8xr6xP4Qc4L//h/Qt028WK2wK/8XZTJYtWG 9tooXe3UGE73IUuceUO2cTuh3KJ+ys+OQ7z8sG809G9xERr4wlJndX/vLwt6fZj74iqj URSLRulJoPfR/HWFfPXMtojTRh+Mj196PDakJdJ1ieCyFibMuUra+g2lQ7fTllHz26NT j3L972f3Nwy8poZJVZbB+SCivPwBPZ0CZnL6RDqsYrmSnWECAEsmAlzkca5mQD4A/0uX ZK4w== X-Gm-Message-State: ACgBeo2gIkWrP397PC1mwj+BcZleRATPhA+SP15WgueXL2RKgoFlJ5mk Eopo1NkwaJwAlItAdHP8Ic0tsjm67LLmf/WXEvYlvYd1vOk7pedVeEWguXToSANYgKBScpia/pr gjyF74TLYv58tdPPeqJBGqvLMZK6VPlnTiQ== X-Received: by 2002:a05:6830:3905:b0:636:b917:731 with SMTP id br5-20020a056830390500b00636b9170731mr10424983otb.276.1660223512131; Thu, 11 Aug 2022 06:11:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR7QEIc69VP1V5HriUcm9fP71jVnKup3kYfO99g0EWqZR5hmtqpS+IzVnPQ+FQcckMA0ECbCkjK0UhIpM+Rw0MQ= X-Received: by 2002:a05:6830:3905:b0:636:b917:731 with SMTP id br5-20020a056830390500b00636b9170731mr10424971otb.276.1660223511929; Thu, 11 Aug 2022 06:11:51 -0700 (PDT) MIME-Version: 1.0 References: <73820.122081107421800679@us-mta-533.us.mimecast.lan> In-Reply-To: <73820.122081107421800679@us-mta-533.us.mimecast.lan> From: Aldy Hernandez Date: Thu, 11 Aug 2022 15:11:43 +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 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Thu, 11 Aug 2022 13:11:56 -0000 OK On Thu, Aug 11, 2022, 13:42 Richard Biener wrote: > This avoids going BBs outside of the path when adding def chains > to the set of imports. It also syncs the code with > range_def_chain::get_def_chain to not miss out on some imports > this function would identify. > > Bootstrap / regtest pending on x86_64-unknown-linux-gnu. > > The question still stands on what the path_range_query::compute_ranges > actually needs in its m_imports - at least I don't easily see how > the range-folds will use the path range cache or be path sensitive > at all. > > OK? > > Thanks, > Richard. > > * gimple-range-path.cc (path_range_query::compute_imports): > Restrict walking SSA defs to blocks inside the path. Track > the same operands as range_def_chain::get_def_chain does. > --- > gcc/gimple-range-path.cc | 39 ++++++++++++++++++++++++++++----------- > 1 file changed, 28 insertions(+), 11 deletions(-) > > diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc > index 5ae374df3a2..5ff2c733b4e 100644 > --- a/gcc/gimple-range-path.cc > +++ b/gcc/gimple-range-path.cc > @@ -575,18 +575,11 @@ path_range_query::compute_imports (bitmap imports, > const vec &path) > { > tree name = worklist.pop (); > gimple *def_stmt = SSA_NAME_DEF_STMT (name); > + if (SSA_NAME_IS_DEFAULT_DEF (name) > + || !path.contains (gimple_bb (def_stmt))) > + continue; > > - if (is_gimple_assign (def_stmt)) > - { > - add_to_imports (gimple_assign_rhs1 (def_stmt), imports); > - tree rhs = gimple_assign_rhs2 (def_stmt); > - if (rhs && add_to_imports (rhs, imports)) > - worklist.safe_push (rhs); > - rhs = gimple_assign_rhs3 (def_stmt); > - if (rhs && add_to_imports (rhs, imports)) > - worklist.safe_push (rhs); > - } > - else if (gphi *phi = dyn_cast (def_stmt)) > + if (gphi *phi = dyn_cast (def_stmt)) > { > for (size_t i = 0; i < gimple_phi_num_args (phi); ++i) > { > @@ -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); > + } > + } > } > // Exported booleans along the path, may help conditionals. > if (m_resolve) > -- > 2.35.3 > >