From: Trevor Saunders <tbsaunde@tbsaunde.org>
To: Christophe Lyon <christophe.lyon@linaro.org>
Cc: Richard Biener <richard.guenther@gmail.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 3/6] return auto_vec from get_loop_hot_path
Date: Thu, 17 Jun 2021 10:41:49 -0400 [thread overview]
Message-ID: <YMtfLe4TkXQgLMEd@rag> (raw)
In-Reply-To: <CAKdteOYBLpAkk1CUen2CpAuGrzdK=52KBLc9zPw673-mhuKNiQ@mail.gmail.com>
On Thu, Jun 17, 2021 at 03:48:28PM +0200, Christophe Lyon wrote:
> On Tue, 15 Jun 2021 at 08:47, Richard Biener via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > On Tue, Jun 15, 2021 at 8:01 AM Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> > >
> > > This ensures callers take ownership of the returned vector.
> > >
> > > Signed-off-by: Trevor Saunders <tbsaunde@tbsaunde.org>
> > >
> > > bootstrapped and regtested on x86_64-linux-gnu, ok?
> >
> > OK.
>
> Since this was committed, I've noticed build errors (for cross-compilers):
> /tmp/9562118_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfgloopanal.c:
> In function 'auto_vec<basic_block_def*> get_loop_hot_path(const
> loop*)':
> /tmp/9562118_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfgloopanal.c:528:10:
> error: could not convert 'path' from 'vec<basic_block_def*>' to
> 'auto_vec<basic_block_def*>'
> return path;
> ^
> /tmp/9562118_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/cfgloopanal.c:529:1:
> warning: control reaches end of non-void function [-Wreturn-type]
> }
> ^
>
> I'm using gcc-4.8.5 as host compiler
Ah, interesting, I believe the following patch corrects the oversight
here. Its interesting that newer compilers use the auto_vec(vec<T> &&)
constructor to fix this up but 4.8.5 refuses.
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index fdd8d3f43fe..2db46c81036 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -504,7 +504,7 @@ auto_vec<basic_block>
get_loop_hot_path (const class loop *loop)
{
basic_block bb = loop->header;
- vec<basic_block> path = vNULL;
+ auto_vec<basic_block> path;
bitmap visited = BITMAP_ALLOC (NULL);
while (true)
Sorry about the trouble, will commit the above as obvious if
it bootstraps.
Trev
>
> Christophe
>
> >
> > > 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.
> > > ---
> > > 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 d0eade3dd34..e7b7ae2163e 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,
> > > --
> > > 2.20.1
> > >
next prev parent reply other threads:[~2021-06-17 14:41 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 5:59 [PATCH 1/6] auto_vec copy/move improvements Trevor Saunders
2021-06-15 5:59 ` [PATCH 2/6] return auto_vec from cgraph_node::collect_callers Trevor Saunders
2021-06-15 6:45 ` Richard Biener
2021-06-15 5:59 ` [PATCH 3/6] return auto_vec from get_loop_hot_path Trevor Saunders
2021-06-15 6:45 ` Richard Biener
2021-06-17 13:48 ` Christophe Lyon
2021-06-17 14:41 ` Trevor Saunders [this message]
2021-06-17 18:34 ` Christophe Lyon
2021-06-15 5:59 ` [PATCH 4/6] return auto_vec from get_dominated_by Trevor Saunders
2021-06-15 6:46 ` Richard Biener
2021-06-15 11:18 ` Bernhard Reutner-Fischer
2021-06-16 3:09 ` Trevor Saunders
2021-06-16 5:45 ` Bernhard Reutner-Fischer
2021-06-17 6:56 ` Trevor Saunders
2021-06-15 5:59 ` [PATCH 5/6] make get_domminated_by_region return a auto_vec Trevor Saunders
2021-06-15 6:49 ` Richard Biener
2021-06-16 12:46 ` Richard Sandiford
2021-06-16 16:01 ` Martin Sebor
2021-06-17 6:03 ` Richard Biener
2021-06-17 8:23 ` Trevor Saunders
2021-06-17 14:43 ` Martin Sebor
2021-06-18 10:38 ` Richard Biener
2021-06-18 10:53 ` Jakub Jelinek
2021-06-18 11:03 ` Jonathan Wakely
2021-06-18 11:04 ` Jonathan Wakely
2021-06-18 16:03 ` Martin Sebor
2021-06-21 7:15 ` Richard Biener
2021-06-22 20:01 ` Martin Sebor
2021-06-23 5:23 ` Trevor Saunders
2021-06-23 7:43 ` Richard Biener
2021-06-23 10:22 ` Richard Sandiford
2021-06-24 9:20 ` Richard Biener
2021-06-24 16:28 ` Richard Sandiford
2021-06-25 8:29 ` Richard Biener
2021-06-23 22:56 ` Martin Sebor
2021-06-24 9:27 ` Richard Biener
2021-06-24 15:01 ` Martin Sebor
2021-06-23 23:43 ` Martin Sebor
2021-06-28 7:01 ` Trevor Saunders
2021-06-15 5:59 ` [PATCH 6/6] return auto_vec from more dominance functions Trevor Saunders
2021-06-15 6:50 ` Richard Biener
2021-06-15 6:42 ` [PATCH 1/6] auto_vec copy/move improvements Richard Biener
2021-06-15 7:04 ` Trevor Saunders
2021-06-15 7:11 ` Richard Biener
2021-06-15 7:57 ` Trevor Saunders
2021-06-15 9:36 ` Richard Biener
2021-06-16 3:17 ` [PATCH, V2] " Trevor Saunders
2021-06-16 10:13 ` Richard Biener
2021-06-16 17:01 ` Martin Sebor
2021-06-15 16:18 ` [PATCH 1/6] " Martin Sebor
2021-06-16 3:31 ` Trevor Saunders
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=YMtfLe4TkXQgLMEd@rag \
--to=tbsaunde@tbsaunde.org \
--cc=christophe.lyon@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
/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).