]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/121802 - fix vect_setup_realignment
authorRichard Biener <rguenther@suse.de>
Fri, 5 Sep 2025 08:35:07 +0000 (10:35 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 5 Sep 2025 10:35:00 +0000 (12:35 +0200)
The following avoids looking at STMT_VINFO_VECTYPE in
vect_setup_realignment and instead passes down the relevant vector
type.

PR tree-optimization/121802
* tree-vectorizer.h (vect_setup_realignment): Add vectype
argument.
* tree-vect-data-refs.cc (vect_setup_realignment): Replace
local vectype with argument.
* tree-vect-stmts.cc (vectorizable_load): Adjust.

gcc/tree-vect-data-refs.cc
gcc/tree-vect-stmts.cc
gcc/tree-vectorizer.h

index e451b72e07eafa929e8d322563b1847e53c31cab..a31ff93bbd3c2e4f5a6ed74a411f58f2bdb0183b 100644 (file)
@@ -6118,13 +6118,12 @@ vect_store_lanes_supported (tree vectype, unsigned HOST_WIDE_INT count,
    Return value - the result of the loop-header phi node.  */
 
 tree
-vect_setup_realignment (vec_info *vinfo, stmt_vec_info stmt_info,
+vect_setup_realignment (vec_info *vinfo, stmt_vec_info stmt_info, tree vectype,
                        gimple_stmt_iterator *gsi, tree *realignment_token,
                        enum dr_alignment_support alignment_support_scheme,
                        tree init_addr,
                        class loop **at_loop)
 {
-  tree vectype = STMT_VINFO_VECTYPE (stmt_info);
   loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo);
   dr_vec_info *dr_info = STMT_VINFO_DR_INFO (stmt_info);
   struct data_reference *dr = dr_info->dr;
index 5b1f291fa8d87ae625a71d17d7b527b1a0bbd44d..edc669ba3e474f6247d1703907b46bd54ca5a4de 100644 (file)
@@ -10210,7 +10210,7 @@ vectorizable_load (vec_info *vinfo,
       if (!costing_p)
        {
          if (!diff_first_stmt_info)
-           msq = vect_setup_realignment (vinfo, first_stmt_info, gsi,
+           msq = vect_setup_realignment (vinfo, first_stmt_info, vectype, gsi,
                                          &realignment_token,
                                          alignment_support_scheme, NULL_TREE,
                                          &at_loop);
@@ -10813,8 +10813,8 @@ vectorizable_load (vec_info *vinfo,
                                         stmt_info, diff);
          if (alignment_support_scheme == dr_explicit_realign)
            {
-             msq = vect_setup_realignment (vinfo,
-                                           first_stmt_info_for_drptr, gsi,
+             msq = vect_setup_realignment (vinfo, first_stmt_info_for_drptr,
+                                           vectype, gsi,
                                            &realignment_token,
                                            alignment_support_scheme,
                                            dataref_ptr, &at_loop);
@@ -11167,8 +11167,8 @@ vectorizable_load (vec_info *vinfo,
            tree vs = size_int (TYPE_VECTOR_SUBPARTS (vectype));
 
            if (compute_in_loop)
-             msq = vect_setup_realignment (vinfo, first_stmt_info, gsi,
-                                           &realignment_token,
+             msq = vect_setup_realignment (vinfo, first_stmt_info, vectype,
+                                           gsi, &realignment_token,
                                            dr_explicit_realign,
                                            dataref_ptr, NULL);
 
index df805c6ade92d5aa7043310739d2dbfff2b236aa..6872f8a03d2a95496d54b2f0cfa80d6d5555c837 100644 (file)
@@ -2647,7 +2647,7 @@ extern bool vect_grouped_load_supported (tree, bool, unsigned HOST_WIDE_INT);
 extern internal_fn vect_load_lanes_supported (tree, unsigned HOST_WIDE_INT,
                                              bool, vec<int> * = nullptr);
 extern tree vect_setup_realignment (vec_info *,
-                                   stmt_vec_info, gimple_stmt_iterator *,
+                                   stmt_vec_info, tree, gimple_stmt_iterator *,
                                    tree *, enum dr_alignment_support, tree,
                                    class loop **);
 extern tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);