Jennifer Schmitz <jschm...@nvidia.com> writes:
> As suggested in the review of
> https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657474.html,
> this patch changes the return type of gimple_folder::redirect_call from
> gimple * to gcall *. The motivation for this is that so far, most callers of
> the function had been casting the result of the function to gcall. These
> call sites were updated.
>
> The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
> OK for mainline?
>
> Signed-off-by: Jennifer Schmitz <jschm...@nvidia.com>
>
> gcc/
>
>       * config/aarch64/aarch64-sve-builtins.cc
>       (gimple_folder::redirect_call): Update return type.
>       * config/aarch64/aarch64-sve-builtins.h: Likewise.
>       * config/aarch64/aarch64-sve-builtins-sve2.cc (svqshl_impl::fold):
>       Remove cast to gcall.
>       (svrshl_impl::fold): Likewise.

OK, thanks.

And sorry for my hypocrisy.  It looks like I was responsible for the
existing instances of as_a<gcall *>, so I should have done this myself
when adding SVE2.

Richard

> From 54bbe7cbcbc1c26171301726ff489c9f0a730e80 Mon Sep 17 00:00:00 2001
> From: Jennifer Schmitz <jschm...@nvidia.com>
> Date: Tue, 23 Jul 2024 03:54:50 -0700
> Subject: [PATCH] SVE Intrinsics: Change return type of redirect_call to gcall.
>
> As suggested in the review of
> https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657474.html,
> this patch changes the return type of gimple_folder::redirect_call from
> gimple * to gcall *. The motivation for this is that so far, most callers of
> the function had been casting the result of the function to gcall. These
> call sites were updated.
>
> The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression.
> OK for mainline?
>
> Signed-off-by: Jennifer Schmitz <jschm...@nvidia.com>
>
> gcc/
>
>       * config/aarch64/aarch64-sve-builtins.cc
>       (gimple_folder::redirect_call): Update return type.
>       * config/aarch64/aarch64-sve-builtins.h: Likewise.
>       * config/aarch64/aarch64-sve-builtins-sve2.cc (svqshl_impl::fold):
>       Remove cast to gcall.
>       (svrshl_impl::fold): Likewise.
> ---
>  gcc/config/aarch64/aarch64-sve-builtins-sve2.cc | 6 +++---
>  gcc/config/aarch64/aarch64-sve-builtins.cc      | 2 +-
>  gcc/config/aarch64/aarch64-sve-builtins.h       | 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc 
> b/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc
> index 4f25cc68028..dc591551682 100644
> --- a/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc
> +++ b/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc
> @@ -349,7 +349,7 @@ public:
>               instance.base_name = "svlsr";
>               instance.base = functions::svlsr;
>             }
> -         gcall *call = as_a <gcall *> (f.redirect_call (instance));
> +         gcall *call = f.redirect_call (instance);
>           gimple_call_set_arg (call, 2, amount);
>           return call;
>         }
> @@ -379,7 +379,7 @@ public:
>           function_instance instance ("svlsl", functions::svlsl,
>                                       shapes::binary_uint_opt_n, MODE_n,
>                                       f.type_suffix_ids, GROUP_none, f.pred);
> -         gcall *call = as_a <gcall *> (f.redirect_call (instance));
> +         gcall *call = f.redirect_call (instance);
>           gimple_call_set_arg (call, 2, amount);
>           return call;
>         }
> @@ -392,7 +392,7 @@ public:
>           function_instance instance ("svrshr", functions::svrshr,
>                                       shapes::shift_right_imm, MODE_n,
>                                       f.type_suffix_ids, GROUP_none, f.pred);
> -         gcall *call = as_a <gcall *> (f.redirect_call (instance));
> +         gcall *call = f.redirect_call (instance);
>           gimple_call_set_arg (call, 2, amount);
>           return call;
>         }
> diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc 
> b/gcc/config/aarch64/aarch64-sve-builtins.cc
> index f3983a123e3..0a560eaedca 100644
> --- a/gcc/config/aarch64/aarch64-sve-builtins.cc
> +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
> @@ -3592,7 +3592,7 @@ gimple_folder::load_store_cookie (tree type)
>  }
>  
>  /* Fold the call to a call to INSTANCE, with the same arguments.  */
> -gimple *
> +gcall *
>  gimple_folder::redirect_call (const function_instance &instance)
>  {
>    registered_function *rfn
> diff --git a/gcc/config/aarch64/aarch64-sve-builtins.h 
> b/gcc/config/aarch64/aarch64-sve-builtins.h
> index 9cc07d5fa3d..9ab6f202c30 100644
> --- a/gcc/config/aarch64/aarch64-sve-builtins.h
> +++ b/gcc/config/aarch64/aarch64-sve-builtins.h
> @@ -629,7 +629,7 @@ public:
>    tree fold_contiguous_base (gimple_seq &, tree);
>    tree load_store_cookie (tree);
>  
> -  gimple *redirect_call (const function_instance &);
> +  gcall *redirect_call (const function_instance &);
>    gimple *redirect_pred_x ();
>  
>    gimple *fold_to_cstu (poly_uint64);

Reply via email to