From patchwork Tue Jun 15 05:59:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Saunders X-Patchwork-Id: 1491988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G3yPK0QgWz9sW7 for ; Tue, 15 Jun 2021 16:01:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A558D3987C28 for ; Tue, 15 Jun 2021 06:01:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from paperclip.tbsaunde.org (unknown [IPv6:2600:3c03::f03c:91ff:fe6e:c625]) by sourceware.org (Postfix) with ESMTP id 176903986831 for ; Tue, 15 Jun 2021 05:59:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 176903986831 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tbsaunde.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tbsaunde.org Received: from caber.home (pool-108-24-42-131.cmdnnj.fios.verizon.net [108.24.42.131]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id EC6B3C085; Tue, 15 Jun 2021 05:59:55 +0000 (UTC) From: Trevor Saunders To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/6] return auto_vec from get_loop_hot_path Date: Tue, 15 Jun 2021 01:59:19 -0400 Message-Id: <20210615055922.27205-3-tbsaunde@tbsaunde.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210615055922.27205-1-tbsaunde@tbsaunde.org> References: <20210615055922.27205-1-tbsaunde@tbsaunde.org> MIME-Version: 1.0 X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_SBL_CSS, 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: , Cc: Trevor Saunders Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This ensures callers take ownership of the returned vector. Signed-off-by: Trevor Saunders bootstrapped and regtested on x86_64-linux-gnu, 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,