https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117554

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |rguenth at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
           Keywords|                            |needs-bisection
   Last reconfirmed|                            |2024-11-13
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah, this is a disconnect between

  if ((*memory_access_type == VMAT_ELEMENTWISE
       || *memory_access_type == VMAT_STRIDED_SLP)
      && single_element_p
      && loop_vinfo
      && vect_use_strided_gather_scatters_p (stmt_info, loop_vinfo,
                                             masked_p, gs_info))
    *memory_access_type = VMAT_GATHER_SCATTER;

where single_element_p == single DR and

  /* ???  The following checks should really be part of
     get_group_load_store_type.  */
  if (slp 
      && SLP_TREE_LOAD_PERMUTATION (slp_node).exists ()
      && !((memory_access_type == VMAT_ELEMENTWISE
            || memory_access_type == VMAT_GATHER_SCATTER)
           && SLP_TREE_LANES (slp_node) == 1)) 
    { 
      slp_perm = true;

where the single element check is SLP_TREE_LANES == 1.  But here we have
a splat:

t.c:10:6: note: node 0x47f5200 (max_nunits=2, refcnt=1) vector(2) char
t.c:10:6: note: op template: _17 = *m_23;
t.c:10:6: note:         [l] stmt 0 _17 = *m_23;
t.c:10:6: note:         [l] stmt 1 _17 = *m_23;
t.c:10:6: note:         load permutation { 0 0 }

fix:

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index baf49ec4cf1..3ad3b9bf371 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -2277,6 +2277,7 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info
stmt_info,
   if ((*memory_access_type == VMAT_ELEMENTWISE
        || *memory_access_type == VMAT_STRIDED_SLP)
       && single_element_p
+      && SLP_TREE_LANES (slp_node) == 1
       && loop_vinfo
       && vect_use_strided_gather_scatters_p (stmt_info, loop_vinfo,
                                             masked_p, gs_info))

Reply via email to