https://gcc.gnu.org/g:58fb3ba1969b6c21abce9b1da06dcb6c2b638c9d

commit r16-1192-g58fb3ba1969b6c21abce9b1da06dcb6c2b638c9d
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Sat May 31 10:22:34 2025 -0700

    aarch64:sve: Use make_ssa_name instead of create_tmp_var in the folder
    
    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
    make_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.
    
    Changes since v1:
    * Use make_ssa_name instead of create_tmp_reg_or_ssa_name, anonymous ssa
      names are allowed early on in gimple too.
    
    Built and tested on aarch64-linux-gnu.
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64-sve-builtins.cc: Include value-range.h and 
tree-ssanames.h
            (gimple_folder::convert_and_fold): Use make_ssa_name
            instead of create_tmp_var for the temporary. Add comment about 
callback argument.
    
    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

Diff:
---
 gcc/config/aarch64/aarch64-sve-builtins.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc 
b/gcc/config/aarch64/aarch64-sve-builtins.cc
index 36519262efd5..2b627a950602 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -47,6 +47,8 @@
 #include "langhooks.h"
 #include "stringpool.h"
 #include "attribs.h"
+#include "value-range.h"
+#include "tree-ssanames.h"
 #include "aarch64-sve-builtins.h"
 #include "aarch64-sve-builtins-base.h"
 #include "aarch64-sve-builtins-sve2.h"
@@ -3664,7 +3666,8 @@ gimple_folder::fold_pfalse ()
 /* Convert the lhs and all non-boolean vector-type operands to TYPE.
    Pass the converted variables to the callback FP, and finally convert the
    result back to the original type. Add the necessary conversion statements.
-   Return the new call.  */
+   Return the new call. Note the tree argument to the callback FP, can only
+   be set once; it will always be a SSA_NAME.  */
 gimple *
 gimple_folder::convert_and_fold (tree type,
                                 gimple *(*fp) (gimple_folder &,
@@ -3675,7 +3678,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 ? make_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);

Reply via email to