From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id 2440D398800E for ; Tue, 15 Jun 2021 06:46:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2440D398800E Received: by mail-ed1-x52d.google.com with SMTP id g18so47622588edq.8 for ; Mon, 14 Jun 2021 23:46:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qgLczM8LgV//CmKP8Dr9hFQ/S0Eae5ojTfdxAtdGaDs=; b=LwSx60MXM2/B1xl6mRlJjgjhSGjfWeQIRv+SzNexPPCJAxMM62Q7hp+EiionuBsSoC GlNCM5Az/lwkUGYsxee+hJppsRVh0gfUPinYY5tZnselIvycS+28m3YPhKjyc+nckvHr Ol8X2ELrYDskSj7yQRVL/+VR+GSpbTY69n9Ag6rxln6XKtka+aNN9mPlO8BQ/VtTmNQw U1iq1lz86IpbPJb1oJX13VvNaopPbVOuktqC1ZWj5/5Sd/3xTh/MSxnRvj3/J6yUs2fb W22zT1uiuEq6zeTzx8l9bkNv/19D8eiDMrvkaJWjuctivZy7PUosfnjR3zxWhfmFdAHP ml5A== X-Gm-Message-State: AOAM530NrMMgflSmlk45lMcEjs6TzIwAcADY7LlXBgb/JOiCYfuHqk2u PJNuteqAoiOAjnl0b37GgHfsXfqfLq0vLEY4OlP86Uxtoh4= X-Google-Smtp-Source: ABdhPJzxpSol5GFugl4Gzkng4kNpO0X9JNAWqax8YGEx6ThuAnJLGkfX8hopubsylOpgz4jDbyHkdLjW9t2BEaw85PA= X-Received: by 2002:a05:6402:3082:: with SMTP id de2mr20796998edb.214.1623739559187; Mon, 14 Jun 2021 23:45:59 -0700 (PDT) MIME-Version: 1.0 References: <20210615055922.27205-1-tbsaunde@tbsaunde.org> <20210615055922.27205-3-tbsaunde@tbsaunde.org> In-Reply-To: <20210615055922.27205-3-tbsaunde@tbsaunde.org> From: Richard Biener Date: Tue, 15 Jun 2021 08:45:48 +0200 Message-ID: Subject: Re: [PATCH 3/6] return auto_vec from get_loop_hot_path To: Trevor Saunders Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.7 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 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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, 15 Jun 2021 06:46:01 -0000 On Tue, Jun 15, 2021 at 8:01 AM Trevor Saunders wrote: > > This ensures callers take ownership of the returned vector. > > Signed-off-by: Trevor Saunders > > bootstrapped and regtested on x86_64-linux-gnu, ok? OK. > gcc/ChangeLog: > > * cfgloop.h (get_loop_hot_path): Return auto_vec. > * cfgloopanal.c (get_loop_hot_path): Likewise. > * tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Likewise. > --- > gcc/cfgloop.h | 2 +- > gcc/cfgloopanal.c | 2 +- > gcc/tree-ssa-loop-ivcanon.c | 5 ++--- > 3 files changed, 4 insertions(+), 5 deletions(-) > > diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h > index 113241da130..5e699276c88 100644 > --- a/gcc/cfgloop.h > +++ b/gcc/cfgloop.h > @@ -840,7 +840,7 @@ enum > > extern void doloop_optimize_loops (void); > extern void move_loop_invariants (void); > -extern vec get_loop_hot_path (const class loop *loop); > +extern auto_vec get_loop_hot_path (const class loop *loop); > > /* Returns the outermost loop of the loop nest that contains LOOP.*/ > static inline class loop * > diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c > index d0eade3dd34..e7b7ae2163e 100644 > --- a/gcc/cfgloopanal.c > +++ b/gcc/cfgloopanal.c > @@ -500,7 +500,7 @@ single_likely_exit (class loop *loop, vec exits) > order against direction of edges from latch. Specially, if > header != latch, latch is the 1-st block. */ > > -vec > +auto_vec > get_loop_hot_path (const class loop *loop) > { > basic_block bb = loop->header; > diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c > index 3f9e9d0869f..b1971f83544 100644 > --- a/gcc/tree-ssa-loop-ivcanon.c > +++ b/gcc/tree-ssa-loop-ivcanon.c > @@ -218,7 +218,7 @@ tree_estimate_loop_size (class loop *loop, edge exit, edge edge_to_cancel, > gimple_stmt_iterator gsi; > unsigned int i; > bool after_exit; > - vec path = get_loop_hot_path (loop); > + auto_vec path = get_loop_hot_path (loop); > > size->overall = 0; > size->eliminated_by_peeling = 0; > @@ -342,7 +342,6 @@ tree_estimate_loop_size (class loop *loop, edge exit, edge edge_to_cancel, > - size->last_iteration_eliminated_by_peeling) > upper_bound) > { > free (body); > - path.release (); > return true; > } > } > @@ -379,7 +378,7 @@ tree_estimate_loop_size (class loop *loop, edge exit, edge edge_to_cancel, > size->num_branches_on_hot_path++; > } > } > - path.release (); > + > if (dump_file && (dump_flags & TDF_DETAILS)) > fprintf (dump_file, "size: %i-%i, last_iteration: %i-%i\n", size->overall, > size->eliminated_by_peeling, size->last_iteration, > -- > 2.20.1 >