public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: GCC patches <gcc-patches@gcc.gnu.org>,
	Andrew MacLeod <amacleod@redhat.com>,
	Martin Sebor <msebor@redhat.com>
Subject: Re: [PATCH 2/5] Convert Walloca pass to RANGE_QUERY(cfun).
Date: Tue, 25 May 2021 10:43:31 +0200	[thread overview]
Message-ID: <CAFiYyc30X=R4q4knNG9WE-XCpd05ZpVeJJJU2A3putaAJzfT0g@mail.gmail.com> (raw)
In-Reply-To: <20210521113954.1148075-2-aldyh@redhat.com>

On Fri, May 21, 2021 at 2:34 PM Aldy Hernandez via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> This patch converts the Walloca pass to use an on-demand ranger
> accesible with RANGE_QUERY instead of having to create a ranger and pass
> it around.
>
> Tested on x86-64 Linux.
>
> OK?
>
> gcc/ChangeLog:
>
>         * gimple-ssa-warn-alloca.c (alloca_call_type): Use RANGE_QUERY
>         instead of query argument.
>         (pass_walloca::execute): Enable and disable global ranger.
> ---
>  gcc/gimple-ssa-warn-alloca.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c
> index e9a24d4d1d0..12f4bce3be8 100644
> --- a/gcc/gimple-ssa-warn-alloca.c
> +++ b/gcc/gimple-ssa-warn-alloca.c
> @@ -165,7 +165,7 @@ adjusted_warn_limit (bool idx)
>  // call was created by the gimplifier for a VLA.
>
>  static class alloca_type_and_limit
> -alloca_call_type (range_query &query, gimple *stmt, bool is_vla)
> +alloca_call_type (gimple *stmt, bool is_vla)
>  {
>    gcc_assert (gimple_alloca_call_p (stmt));
>    tree len = gimple_call_arg (stmt, 0);
> @@ -217,7 +217,7 @@ alloca_call_type (range_query &query, gimple *stmt, bool is_vla)
>    int_range_max r;
>    if (warn_limit_specified_p (is_vla)
>        && TREE_CODE (len) == SSA_NAME
> -      && query.range_of_expr (r, len, stmt)
> +      && RANGE_QUERY (cfun)->range_of_expr (r, len, stmt)

please avoid new references to 'cfun' and instead pass ...

>        && !r.varying_p ())
>      {
>        // The invalid bits are anything outside of [0, MAX_SIZE].
> @@ -256,7 +256,7 @@ in_loop_p (gimple *stmt)
>  unsigned int
>  pass_walloca::execute (function *fun)

... 'fun' down.

>  {
> -  gimple_ranger ranger;
> +  enable_ranger ();
>    basic_block bb;
>    FOR_EACH_BB_FN (bb, fun)
>      {
> @@ -290,7 +290,7 @@ pass_walloca::execute (function *fun)
>             continue;
>
>           class alloca_type_and_limit t
> -           = alloca_call_type (ranger, stmt, is_vla);
> +           = alloca_call_type (stmt, is_vla);
>
>           unsigned HOST_WIDE_INT adjusted_alloca_limit
>             = adjusted_warn_limit (false);
> @@ -383,6 +383,7 @@ pass_walloca::execute (function *fun)
>             }
>         }
>      }
> +  disable_ranger ();
>    return 0;
>  }
>
> --
> 2.31.1
>

  reply	other threads:[~2021-05-25  8:43 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 11:39 [PATCH 1/5] Common API for accessing global and on-demand ranges Aldy Hernandez
2021-05-21 11:39 ` [PATCH 2/5] Convert Walloca pass to RANGE_QUERY(cfun) Aldy Hernandez
2021-05-25  8:43   ` Richard Biener [this message]
2021-05-25 16:17   ` Aldy Hernandez
2021-05-25 16:28     ` Jeff Law
2021-05-25 17:28     ` Martin Sebor
2021-05-27  7:38     ` Christophe Lyon
2021-05-27  8:34       ` Aldy Hernandez
2021-05-21 11:39 ` [PATCH 3/5] Convert evrp " Aldy Hernandez
2021-05-25 16:18   ` Aldy Hernandez
2021-05-27  2:34     ` H.J. Lu
2021-05-21 11:39 ` [PATCH 4/5] Convert remaining passes to RANGE_QUERY Aldy Hernandez
2021-05-24 19:34   ` Martin Sebor
2021-05-25  8:47     ` Richard Biener
2021-05-25  9:15       ` Aldy Hernandez
2021-05-25 11:26       ` Aldy Hernandez
2021-05-25  8:48     ` Aldy Hernandez
2021-05-25 16:19   ` Aldy Hernandez
2021-05-21 11:39 ` [PATCH 5/5] Cleanup get_range_info Aldy Hernandez
2021-05-25 16:20   ` Aldy Hernandez
2021-05-24 16:09 ` [PATCH 1/5] Common API for accessing global and on-demand ranges Aldy Hernandez
2021-05-25  8:57   ` Richard Biener
2021-05-25  9:36     ` Aldy Hernandez
2021-05-25  9:46       ` Richard Biener
2021-05-25 10:53         ` Aldy Hernandez
2021-05-25 11:06           ` Richard Biener
2021-05-25 16:16             ` Aldy Hernandez
2021-05-26 13:40               ` Andrew MacLeod
2021-05-29  4:35               ` Jeff Law
2021-05-24 19:13 ` Martin Sebor
2021-05-25  7:06   ` Aldy Hernandez

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='CAFiYyc30X=R4q4knNG9WE-XCpd05ZpVeJJJU2A3putaAJzfT0g@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=msebor@redhat.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).