From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 177D03858C83 for ; Fri, 19 Aug 2022 07:31:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 177D03858C83 Received: by mail-ed1-x534.google.com with SMTP id o22so4626266edc.10 for ; Fri, 19 Aug 2022 00:31:43 -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=AeN91qOsEpBaahpiwGyUBm1Gmg0BXQHpdzAQ3HR+AUc=; b=D6n8s+ykWDFa8v95O3qs2H5b2YpwKo3kNAbytVciP37Jyj+4kMhehITO0rq2pClEj2 HDP514MrTuOdJ+dvmPJwx7eE8nbUJcmZPQbRH57f9MqIG0OYDjs8prLOQ3aM8u0Unv78 7+iuV9QSOjo1213hzpm8ecxVawy/73ku1RqqaybwsYJWYQ4UcVpupKEUe+uFhyk3mI2+ roPuakqMVohrE7UyLSmrHiec/GFBEU8TRUN5hjJFBXSOe1byN1mgm1H9ufXy2eNBANwr pxhQOr7vPlZe2spFaDhkcW+jvnkJo7CBDWFRRD60ZIUyKuV2MsBX6GgF43fCDYANNFFQ ADAQ== X-Gm-Message-State: ACgBeo3DhmZPDC/ETfFH1/Ee6fMRpVMDb4SOthkuOws9wr/PGweYBxpP UC+q3zLLm1WyxEAlx6BydOrbdgt+yf5mYR9chGiB745I X-Google-Smtp-Source: AA6agR4EU6/fsQgzNaJqn142bE8LHPeUzCM7NwE0o5oOvHYyKObor7gi5Nn0FdPF/8tXWqHZGDGyu5V4xZbpFEbt/ik= X-Received: by 2002:a05:6402:2684:b0:43d:9964:d2a0 with SMTP id w4-20020a056402268400b0043d9964d2a0mr5127225edd.250.1660894301788; Fri, 19 Aug 2022 00:31:41 -0700 (PDT) MIME-Version: 1.0 References: <20220818161323.642918-1-aldyh@redhat.com> In-Reply-To: <20220818161323.642918-1-aldyh@redhat.com> From: Richard Biener Date: Fri, 19 Aug 2022 09:31:29 +0200 Message-ID: Subject: Re: [PATCH] Remove path_range_query constructor that takes an edge. To: Aldy Hernandez Cc: Andrew MacLeod , GCC patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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: Fri, 19 Aug 2022 07:31:45 -0000 On Thu, Aug 18, 2022 at 6:13 PM Aldy Hernandez wrote: > > The path_range_query constructor that takes an edge is really a > convenience function for the loop-ch pass. It feels wrong to pollute > the API with such a specialized function that could be done with > a small inline function closer to its user. > > As an added benefit, we remove one use of reset_path. The last > remaining one is the forward threader one. > > OK? OK. > gcc/ChangeLog: > > * gimple-range-path.cc (path_range_query::path_range_query): > Remove constructor that takes edge. > * gimple-range-path.h (class path_range_query): Same. > * tree-ssa-loop-ch.cc (edge_range_query): New. > (entry_loop_condition_is_static): Call edge_range_query. > --- > gcc/gimple-range-path.cc | 15 --------------- > gcc/gimple-range-path.h | 1 - > gcc/tree-ssa-loop-ch.cc | 17 +++++++++++++++-- > 3 files changed, 15 insertions(+), 18 deletions(-) > > diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc > index ba7c2ed9b47..bc2879c0c57 100644 > --- a/gcc/gimple-range-path.cc > +++ b/gcc/gimple-range-path.cc > @@ -59,21 +59,6 @@ path_range_query::path_range_query (gimple_ranger &ranger, bool resolve) > m_oracle = new path_oracle (m_ranger.oracle ()); > } > > -path_range_query::path_range_query (gimple_ranger &ranger, > - edge e, > - bool resolve) > - : m_cache (new ssa_global_cache), > - m_has_cache_entry (BITMAP_ALLOC (NULL)), > - m_ranger (ranger), > - m_resolve (resolve) > -{ > - m_oracle = new path_oracle (m_ranger.oracle ()); > - auto_vec bbs (2); > - bbs.quick_push (e->dest); > - bbs.quick_push (e->src); > - reset_path (bbs, NULL); > -} > - > path_range_query::~path_range_query () > { > delete m_oracle; > diff --git a/gcc/gimple-range-path.h b/gcc/gimple-range-path.h > index 483fde0d431..9f2d6d92dab 100644 > --- a/gcc/gimple-range-path.h > +++ b/gcc/gimple-range-path.h > @@ -37,7 +37,6 @@ public: > const bitmap_head *dependencies = NULL, > bool resolve = true); > path_range_query (gimple_ranger &ranger, bool resolve = true); > - path_range_query (gimple_ranger &ranger, edge e, bool resolve = true); > virtual ~path_range_query (); > void reset_path (const vec &, const bitmap_head *dependencies); > bool range_of_expr (vrange &r, tree name, gimple * = NULL) override; > diff --git a/gcc/tree-ssa-loop-ch.cc b/gcc/tree-ssa-loop-ch.cc > index 96816b89287..9c316887d5b 100644 > --- a/gcc/tree-ssa-loop-ch.cc > +++ b/gcc/tree-ssa-loop-ch.cc > @@ -45,6 +45,20 @@ along with GCC; see the file COPYING3. If not see > increases effectiveness of code motion optimizations, and reduces the need > for loop preconditioning. */ > > +/* Given a path through edge E, whose last statement is COND, return > + the range of the solved conditional in R. */ > + > +static void > +edge_range_query (irange &r, edge e, gcond *cond, gimple_ranger &ranger) > +{ > + auto_vec path (2); > + path.safe_push (e->dest); > + path.safe_push (e->src); > + path_range_query query (ranger, path); > + if (!query.range_of_stmt (r, cond)) > + r.set_varying (boolean_type_node); > +} > + > /* Return true if the condition on the first iteration of the loop can > be statically determined. */ > > @@ -72,8 +86,7 @@ entry_loop_condition_is_static (class loop *l, gimple_ranger *ranger) > desired_static_value = boolean_true_node; > > int_range<2> r; > - path_range_query query (*ranger, e); > - query.range_of_stmt (r, last); > + edge_range_query (r, e, last, *ranger); > return r == int_range<2> (desired_static_value, desired_static_value); > } > > -- > 2.37.1 >