On Sun, Jun 1, 2025 at 6:57 PM Andrew Pinski <pins...@gmail.com> wrote:
>
> On Sun, Jun 1, 2025 at 3:54 AM Richard Biener
> <richard.guent...@gmail.com> wrote:
> >
> > On Sat, May 31, 2025 at 8:41 PM Andrew Pinski <quic_apin...@quicinc.com> 
> > wrote:
> > >
> > > Currently gimple_folder::convert_and_fold calls create_tmp_var; that 
> > > means while in ssa form,
> > > the pass which calls fold_stmt will always have to update the ssa (via 
> > > TODO_update_ssa or otherwise).
> > > This seems not very useful since we know that this will always be a ssa 
> > > name, using create_tmp_reg_or_ssa_name
> > > instead is better and don't need to depend on the ssa updater. Plus this 
> > > should have a small compile time performance
> > > and memory usage improvement too since this uses an anonymous ssa name 
> > > rather than creating a full decl for this.
> >
> > Note the gimple_in_ssa_p check in create_tmp_reg_or_ssa_name is
> > superfluous these days
> > given the gimplifier already creates SSA names for temporaries when
> > not in SSA form
> > (no PHI nodes, no CFG).  So in principle we could switch
> > create_tmp_reg to always yield a SSA name.
> >
> > Thus for the fixup here I'd suggest using make_ssa_name (type) instead.
>
> yes that worked, I submitted
> https://gcc.gnu.org/pipermail/gcc-patches/2025-June/685263.html for
> that.
> I am waiting on this being approved before pushing the CCP patch that
> removes update_ssa since the CCP exposes this issue.

I'm testing removal of create_tmp_reg_or_ssa_name.  Changing
create_tmp_reg fails spectacularly (we can remove that instead, and
selectively replace it with create_tmp_var or make_ssa_name, but
that's for another day).

Richard.

> Thanks,
> Andrew
>
> >
> > Richard.
> >
> > > Built and tested on aarch64-linux-gnu.
> > >
> > > gcc/ChangeLog:
> > >
> > >         * config/aarch64/aarch64-sve-builtins.cc 
> > > (gimple_folder::convert_and_fold): Use create_tmp_reg_or_ssa_name
> > >         instead of create_tmp_var for the temporary.
> > >
> > > Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
> > > ---
> > >  gcc/config/aarch64/aarch64-sve-builtins.cc | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc 
> > > b/gcc/config/aarch64/aarch64-sve-builtins.cc
> > > index 36519262efd..329237b086d 100644
> > > --- a/gcc/config/aarch64/aarch64-sve-builtins.cc
> > > +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
> > > @@ -3675,7 +3675,7 @@ gimple_folder::convert_and_fold (tree type,
> > >    tree old_ty = TREE_TYPE (lhs);
> > >    gimple_seq stmts = NULL;
> > >    bool convert_lhs_p = !useless_type_conversion_p (type, old_ty);
> > > -  tree lhs_conv = convert_lhs_p ? create_tmp_var (type) : lhs;
> > > +  tree lhs_conv = convert_lhs_p ? create_tmp_reg_or_ssa_name (type) : 
> > > lhs;
> > >    unsigned int num_args = gimple_call_num_args (call);
> > >    auto_vec<tree, 16> args_conv;
> > >    args_conv.safe_grow (num_args);
> > > --
> > > 2.43.0
> > >

Reply via email to