The following makes dataref analysis not set STMT_VINFO_VECTYPE.
This leaves the field ready for taking when vectorizable_*
transition to use SLP_TREE_VECTYPE.  It also delays determining
the vectorization mode a little bit - SLP build will first do
that then.  I have kept a check that there is any vector type
for the scalar type in vect_analyze_data_refs, that handles
early outs for aggregate and existing vector types.

        * tree-vect-data-refs.cc (vect_analyze_data_refs): Do not
        set STMT_VINFO_VECTYPE.
---
 gcc/tree-vect-data-refs.cc | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index b62498b34bd..89d5426bb11 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -5242,10 +5242,9 @@ vect_analyze_data_refs (vec_info *vinfo, bool *fatal)
                             STMT_VINFO_DR_STEP_ALIGNMENT (stmt_info));
        }
 
-      /* Set vectype for STMT.  */
+      /* Check whether there is any vectype for STMT.  */
       scalar_type = TREE_TYPE (DR_REF (dr));
-      tree vectype = get_vectype_for_scalar_type (vinfo, scalar_type);
-      if (!vectype)
+      if (! get_related_vectype_for_scalar_type (VOIDmode, scalar_type))
         {
           if (dump_enabled_p ())
             {
@@ -5273,18 +5272,6 @@ vect_analyze_data_refs (vec_info *vinfo, bool *fatal)
                                         " scalar_type: %T\n",
                                         stmt_info->stmt, scalar_type);
         }
-      else
-       {
-         if (dump_enabled_p ())
-           dump_printf_loc (MSG_NOTE, vect_location,
-                            "got vectype for stmt: %G%T\n",
-                            stmt_info->stmt, vectype);
-       }
-
-      /* Leave the BB vectorizer to pick the vector type later, based on
-        the final dataref group size and SLP node size.  */
-      if (is_a <loop_vec_info> (vinfo))
-       STMT_VINFO_VECTYPE (stmt_info) = vectype;
 
       if (gatherscatter != SG_NONE)
        {
-- 
2.43.0

Reply via email to