https://gcc.gnu.org/g:6581a831fd548819097b1172b9488cd7c7d82a41

commit r17-2620-g6581a831fd548819097b1172b9488cd7c7d82a41
Author: Richard Biener <[email protected]>
Date:   Wed Jul 22 12:58:47 2026 +0200

    Fix SLP scheduling in-region check
    
    This corrects assessing whether a stmt is inside the vector region,
    checking random stmt UIDs against -1 does not work for loop vectorization.
    
            * tree-vect-slp.cc (vect_schedule_slp_node): Correct in-region
            stmt check.

Diff:
---
 gcc/tree-vect-slp.cc | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index fe406a4cb6a4..7cb0c749fa32 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -11953,15 +11953,12 @@ vect_schedule_slp_node (vec_info *vinfo,
            unsigned j;
            tree def;
            FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_OPS (child), j, def)
-             if (TREE_CODE (def) == SSA_NAME
-                 && !SSA_NAME_IS_DEFAULT_DEF (def))
+             /* If the stmt is not inside the region do not
+                use it as possible insertion point.  */
+             if (auto stmt_info = vinfo->lookup_def (def))
                {
-                 gimple *stmt = SSA_NAME_DEF_STMT (def);
-                 if (gimple_uid (stmt) == -1u)
-                   /* If the stmt is not inside the region do not
-                      use it as possible insertion point.  */
-                   ;
-                 else if (!last_stmt)
+                 gimple *stmt = stmt_info->stmt;
+                 if (!last_stmt)
                    last_stmt = stmt;
                  else if (vect_stmt_dominates_stmt_p (last_stmt, stmt))
                    last_stmt = stmt;

Reply via email to