public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Trevor Saunders <tbsaunde@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1555] return auto_vec from get_loop_hot_path
Date: Thu, 17 Jun 2021 09:12:01 +0000 (GMT)	[thread overview]
Message-ID: <20210617091201.4A2F6388880A@sourceware.org> (raw)

https://gcc.gnu.org/g:a165040e11e340f6b397104f23717ef398408e67

commit r12-1555-ga165040e11e340f6b397104f23717ef398408e67
Author: Trevor Saunders <tbsaunde@tbsaunde.org>
Date:   Sun Jun 6 20:13:38 2021 -0400

    return auto_vec from get_loop_hot_path
    
    This ensures callers take ownership of the returned vector.
    
    Signed-off-by: Trevor Saunders <tbsaunde@tbsaunde.org>
    
    gcc/ChangeLog:
    
            * cfgloop.h (get_loop_hot_path): Return auto_vec<basic_block>.
            * cfgloopanal.c (get_loop_hot_path): Likewise.
            * tree-ssa-loop-ivcanon.c (tree_estimate_loop_size): Likewise.

Diff:
---
 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<basic_block> get_loop_hot_path (const class loop *loop);
+extern auto_vec<basic_block> 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 54426b54881..fdd8d3f43fe 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -500,7 +500,7 @@ single_likely_exit (class loop *loop, vec<edge> exits)
    order against direction of edges from latch.  Specially, if
    header != latch, latch is the 1-st block.  */
 
-vec<basic_block>
+auto_vec<basic_block>
 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<basic_block> path = get_loop_hot_path (loop);
+  auto_vec<basic_block> 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,


                 reply	other threads:[~2021-06-17  9:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210617091201.4A2F6388880A@sourceware.org \
    --to=tbsaunde@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).