https://gcc.gnu.org/g:a9883211f8891a3cb5966cbe2fbec35e25631d83

commit r17-465-ga9883211f8891a3cb5966cbe2fbec35e25631d83
Author: Richard Biener <[email protected]>
Date:   Tue May 12 10:40:56 2026 +0200

    Avoid setting ls_type when unused
    
    The following avoids setting the ls_type on loads/stores when that
    type isn't used.
    
            * tree-vect-stmts.cc (get_load_store_type): Pass
            temporary to vect_use_grouped_gather, only set ls_type
            when that succeeded.

Diff:
---
 gcc/tree-vect-stmts.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 3b88a6e78014..a74e03cc0f65 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -2451,6 +2451,7 @@ get_load_store_type (vec_info  *vinfo, stmt_vec_info 
stmt_info,
          || *memory_access_type == VMAT_STRIDED_SLP))
     {
       gather_scatter_info gs_info;
+      tree tem;
       if (SLP_TREE_LANES (slp_node) == 1
          && (!SLP_TREE_LOAD_PERMUTATION (slp_node).exists ()
              || single_element_p)
@@ -2483,14 +2484,14 @@ get_load_store_type (vec_info  *vinfo, stmt_vec_info 
stmt_info,
               && vect_use_grouped_gather (STMT_VINFO_DR_INFO (stmt_info),
                                           vectype, loop_vinfo,
                                           masked_p, group_size,
-                                          &gs_info, elsvals, ls_type))
+                                          &gs_info, elsvals, &tem))
        {
          SLP_TREE_GS_SCALE (slp_node) = gs_info.scale;
          SLP_TREE_GS_BASE (slp_node) = error_mark_node;
          grouped_gather_fallback = *memory_access_type;
          *memory_access_type = VMAT_GATHER_SCATTER_IFN;
          ls->gs.ifn = gs_info.ifn;
-         vectype = *ls_type;
+         vectype = *ls_type = tem;
          ls->strided_offset_vectype = gs_info.offset_vectype;
        }
     }

Reply via email to