The following gets rid of the restriction in BB vectorization
where we needed to ensure underlying stmts vector types agree
for all uses in all SLP instances.  That's done by recording
the vector type for SLP nodes in all cases and using that
when analyzing/code-generating by means of adjusting STMT_VINFO_VECTYPE
for participating stmts around analysis/transform calls.

As this gets rid of the last user of STMT_VINFO_NUM_SLP_USES the
patch removes that as well.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2020-06-12  Richard Biener  <[email protected]>

        * tree-vectorizer.h (_stmt_vec_info::num_slp_uses): Remove.
        (STMT_VINFO_NUM_SLP_USES): Likewise.
        (vect_free_slp_instance): Adjust.
        (vect_slp_push_vectype): New.
        (vect_slp_pop_vectype): Likewise.
        * tree-vect-data-refs.c
        (vect_slp_analyze_and_verify_instance_alignment): Push/pop
        vectype around analysis.
        * tree-vect-loop.c (vect_transform_loop): Adjust.
        * tree-vect-slp.c (vect_free_slp_tree): Remove STMT_VINFO_NUM_SLP_USES
        updating.
        (vect_create_new_slp_node): Likewise.
        (vect_free_slp_instance): Adjust.
        (vect_update_shared_vectype): Remove.
        (vect_build_slp_tree_1): Do not set STMT_VINFO_VECTYPE but
        the passed in *vectype parameter.
        (vect_build_slp_tree_2): Set SLP_TREE_VECTYPE from what
        vect_build_slp_tree_1 computed.
        (slp_copy_subtree): Do not update STMT_VINFO_NUM_SLP_USES.
        (vect_attempt_slp_rearrange_stmts): Adjust.
        (vect_analyze_slp_instance): Likewise.
        (vect_analyze_slp): Likewise.
        (vect_slp_push_vectype): New.
        (vect_slp_pop_vectype): Likewise.
        (vect_slp_analyze_node_operations_1): Push/pop vectype
        around analysis.
        (vect_schedule_slp_instance): Likewise.
        (vect_slp_analyze_operations): Adjust.
        (vect_slp_analyze_bb_1): Likewise.
        * tree-vect-stmts.c (vect_is_simple_use): Take the vector type
        from SLP_TREE_VECTYPE.
        * tree-vectorizer.c (vec_info::~vec_info): Adjust.
---
 gcc/tree-vect-data-refs.c |  22 +++--
 gcc/tree-vect-loop.c      |   4 +-
 gcc/tree-vect-slp.c       | 176 ++++++++++++++++----------------------
 gcc/tree-vect-stmts.c     |  12 +--
 gcc/tree-vectorizer.c     |   2 +-
 gcc/tree-vectorizer.h     |   8 +-
 6 files changed, 104 insertions(+), 120 deletions(-)

diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 39d5a1b554c..17da2da10a1 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -2466,15 +2466,25 @@ vect_slp_analyze_and_verify_instance_alignment 
(vec_info *vinfo,
 
   slp_tree node;
   unsigned i;
+  auto_vec<tree> saved_vectypes;
   FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (instance), i, node)
-    if (! vect_slp_analyze_and_verify_node_alignment (vinfo, node))
-      return false;
+    {
+      vect_slp_push_vectype (node, &saved_vectypes);
+      bool res = vect_slp_analyze_and_verify_node_alignment (vinfo, node);
+      vect_slp_pop_vectype (node, &saved_vectypes);
+      if (! res)
+       return false;
+    }
 
   node = SLP_INSTANCE_TREE (instance);
-  if (STMT_VINFO_DATA_REF (SLP_TREE_REPRESENTATIVE (node))
-      && ! vect_slp_analyze_and_verify_node_alignment
-            (vinfo, SLP_INSTANCE_TREE (instance)))
-    return false;
+  if (STMT_VINFO_DATA_REF (SLP_TREE_REPRESENTATIVE (node)))
+    {
+      vect_slp_push_vectype (node, &saved_vectypes);
+      bool res = vect_slp_analyze_and_verify_node_alignment (vinfo, node);
+      vect_slp_pop_vectype (node, &saved_vectypes);
+      if (! res)
+       return false;
+    }
 
   return true;
 }
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index f4d47e05bd4..e03bc9c8928 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -2328,7 +2328,7 @@ again:
   LOOP_VINFO_VECT_FACTOR (loop_vinfo) = saved_vectorization_factor;
   /* Free the SLP instances.  */
   FOR_EACH_VEC_ELT (LOOP_VINFO_SLP_INSTANCES (loop_vinfo), j, instance)
-    vect_free_slp_instance (instance, false);
+    vect_free_slp_instance (instance);
   LOOP_VINFO_SLP_INSTANCES (loop_vinfo).release ();
   /* Reset SLP type to loop_vect on all stmts.  */
   for (i = 0; i < LOOP_VINFO_LOOP (loop_vinfo)->num_nodes; ++i)
@@ -8827,7 +8827,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple 
*loop_vectorized_call)
      won't work.  */
   slp_instance instance;
   FOR_EACH_VEC_ELT (LOOP_VINFO_SLP_INSTANCES (loop_vinfo), i, instance)
-    vect_free_slp_instance (instance, true);
+    vect_free_slp_instance (instance);
   LOOP_VINFO_SLP_INSTANCES (loop_vinfo).release ();
   /* Clear-up safelen field since its value is invalid after vectorization
      since vectorized loop can have loop-carried dependencies.  */
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 303410c2fc4..986c2cc37ac 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -84,7 +84,7 @@ _slp_tree::~_slp_tree ()
    made a final decision not to vectorize the statements in any way.  */
 
 static void
-vect_free_slp_tree (slp_tree node, bool final_p)
+vect_free_slp_tree (slp_tree node)
 {
   int i;
   slp_tree child;
@@ -93,21 +93,7 @@ vect_free_slp_tree (slp_tree node, bool final_p)
     return;
 
   FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
-    vect_free_slp_tree (child, final_p);
-
-  /* Don't update STMT_VINFO_NUM_SLP_USES if it isn't relevant.
-     Some statements might no longer exist, after having been
-     removed by vect_transform_stmt.  Updating the remaining
-     statements would be redundant.  */
-  if (!final_p)
-    {
-      stmt_vec_info stmt_info;
-      FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
-       {
-         gcc_assert (STMT_VINFO_NUM_SLP_USES (stmt_info) > 0);
-         STMT_VINFO_NUM_SLP_USES (stmt_info)--;
-       }
-    }
+    vect_free_slp_tree (child);
 
   delete node;
 }
@@ -117,9 +103,9 @@ vect_free_slp_tree (slp_tree node, bool final_p)
    to vectorize the statements in any way.  */
 
 void
-vect_free_slp_instance (slp_instance instance, bool final_p)
+vect_free_slp_instance (slp_instance instance)
 {
-  vect_free_slp_tree (SLP_INSTANCE_TREE (instance), final_p);
+  vect_free_slp_tree (SLP_INSTANCE_TREE (instance));
   SLP_INSTANCE_LOADS (instance).release ();
   free (instance);
 }
@@ -136,12 +122,6 @@ vect_create_new_slp_node (vec<stmt_vec_info> scalar_stmts, 
unsigned nops)
   SLP_TREE_DEF_TYPE (node) = vect_internal_def;
   SLP_TREE_REPRESENTATIVE (node) = scalar_stmts[0];
   SLP_TREE_LANES (node) = scalar_stmts.length ();
-
-  unsigned i;
-  stmt_vec_info stmt_info;
-  FOR_EACH_VEC_ELT (scalar_stmts, i, stmt_info)
-    STMT_VINFO_NUM_SLP_USES (stmt_info)++;
-
   return node;
 }
 
@@ -568,57 +548,6 @@ again:
   return 0;
 }
 
-/* Try to assign vector type VECTYPE to STMT_INFO for BB vectorization.
-   Return true if we can, meaning that this choice doesn't conflict with
-   existing SLP nodes that use STMT_INFO.  */
-
-static bool
-vect_update_shared_vectype (stmt_vec_info stmt_info, tree vectype)
-{
-  tree old_vectype = STMT_VINFO_VECTYPE (stmt_info);
-  if (old_vectype && useless_type_conversion_p (vectype, old_vectype))
-    return true;
-
-  if (STMT_VINFO_GROUPED_ACCESS (stmt_info)
-      && DR_IS_READ (STMT_VINFO_DATA_REF (stmt_info)))
-    {
-      /* We maintain the invariant that if any statement in the group is
-        used, all other members of the group have the same vector type.  */
-      stmt_vec_info first_info = DR_GROUP_FIRST_ELEMENT (stmt_info);
-      stmt_vec_info member_info = first_info;
-      for (; member_info; member_info = DR_GROUP_NEXT_ELEMENT (member_info))
-       if (STMT_VINFO_NUM_SLP_USES (member_info) > 0
-           || is_pattern_stmt_p (member_info))
-         break;
-
-      if (!member_info)
-       {
-         for (member_info = first_info; member_info;
-              member_info = DR_GROUP_NEXT_ELEMENT (member_info))
-           STMT_VINFO_VECTYPE (member_info) = vectype;
-         return true;
-       }
-    }
-  else if (STMT_VINFO_NUM_SLP_USES (stmt_info) == 0
-          && !is_pattern_stmt_p (stmt_info))
-    {
-      STMT_VINFO_VECTYPE (stmt_info) = vectype;
-      return true;
-    }
-
-  if (dump_enabled_p ())
-    {
-      dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-                      "Build SLP failed: incompatible vector"
-                      " types for: %G", stmt_info->stmt);
-      dump_printf_loc (MSG_NOTE, vect_location,
-                      "    old vector type: %T\n", old_vectype);
-      dump_printf_loc (MSG_NOTE, vect_location,
-                      "    new vector type: %T\n", vectype);
-    }
-  return false;
-}
-
 /* Return true if call statements CALL1 and CALL2 are similar enough
    to be combined into the same SLP group.  */
 
@@ -744,7 +673,7 @@ static bool
 vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
                       vec<stmt_vec_info> stmts, unsigned int group_size,
                       poly_uint64 *max_nunits, bool *matches,
-                      bool *two_operators)
+                      bool *two_operators, tree *node_vectype)
 {
   unsigned int i;
   stmt_vec_info first_stmt_info = stmts[0];
@@ -811,10 +740,6 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char 
*swap,
 
       gcc_assert (vectype);
 
-      if (is_a <bb_vec_info> (vinfo)
-         && !vect_update_shared_vectype (stmt_info, vectype))
-       continue;
-
       gcall *call_stmt = dyn_cast <gcall *> (stmt);
       if (call_stmt)
        {
@@ -848,6 +773,7 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
       /* Check the operation.  */
       if (i == 0)
        {
+         *node_vectype = vectype;
          first_stmt_code = rhs_code;
 
          /* Shift arguments should be equal in all the packed stmts for a
@@ -1259,14 +1185,17 @@ vect_build_slp_tree_2 (vec_info *vinfo,
        return NULL;
       (*tree_size)++;
       node = vect_create_new_slp_node (stmts, 0);
+      SLP_TREE_VECTYPE (node) = vectype;
       return node;
     }
 
 
   bool two_operators = false;
   unsigned char *swap = XALLOCAVEC (unsigned char, group_size);
+  tree vectype = NULL_TREE;
   if (!vect_build_slp_tree_1 (vinfo, swap, stmts, group_size,
-                             &this_max_nunits, matches, &two_operators))
+                             &this_max_nunits, matches, &two_operators,
+                             &vectype))
     return NULL;
 
   /* If the SLP node is a load, terminate the recursion unless masked.  */
@@ -1284,6 +1213,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
          *max_nunits = this_max_nunits;
          (*tree_size)++;
          node = vect_create_new_slp_node (stmts, 0);
+         SLP_TREE_VECTYPE (node) = vectype;
          /* And compute the load permutation.  Whether it is actually
             a permutation depends on the unrolling factor which is
             decided later.  */
@@ -1468,7 +1398,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
 fail:
       gcc_assert (child == NULL);
       FOR_EACH_VEC_ELT (children, j, child)
-       vect_free_slp_tree (child, false);
+       vect_free_slp_tree (child);
       vect_free_oprnd_info (oprnds_info);
       return NULL;
     }
@@ -1494,7 +1424,7 @@ fail:
        {
          /* Roll back.  */
          FOR_EACH_VEC_ELT (children, j, child)
-           vect_free_slp_tree (child, false);
+           vect_free_slp_tree (child);
 
          if (dump_enabled_p ())
            dump_printf_loc (MSG_NOTE, vect_location,
@@ -1509,6 +1439,7 @@ fail:
 
   node = vect_create_new_slp_node (stmts, nops);
   SLP_TREE_TWO_OPERATORS (node) = two_operators;
+  SLP_TREE_VECTYPE (node) = vectype;
   SLP_TREE_CHILDREN (node).splice (children);
   return node;
 }
@@ -1677,12 +1608,7 @@ slp_copy_subtree (slp_tree node, hash_map<slp_tree, 
slp_tree> &map)
   copy->max_nunits = node->max_nunits;
   copy->refcnt = 0;
   if (SLP_TREE_SCALAR_STMTS (node).exists ())
-    {
-      SLP_TREE_SCALAR_STMTS (copy) = SLP_TREE_SCALAR_STMTS (node).copy ();
-      stmt_vec_info stmt_info;
-      FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
-       STMT_VINFO_NUM_SLP_USES (stmt_info)++;
-    }
+    SLP_TREE_SCALAR_STMTS (copy) = SLP_TREE_SCALAR_STMTS (node).copy ();
   if (SLP_TREE_SCALAR_OPS (node).exists ())
     SLP_TREE_SCALAR_OPS (copy) = SLP_TREE_SCALAR_OPS (node).copy ();
   if (SLP_TREE_LOAD_PERMUTATION (node).exists ())
@@ -1798,7 +1724,7 @@ vect_attempt_slp_rearrange_stmts (slp_instance slp_instn)
   /* We have to unshare the SLP tree we modify.  */
   hash_map<slp_tree, slp_tree> map;
   slp_tree unshared = slp_copy_subtree (SLP_INSTANCE_TREE (slp_instn), map);
-  vect_free_slp_tree (SLP_INSTANCE_TREE (slp_instn), false);
+  vect_free_slp_tree (SLP_INSTANCE_TREE (slp_instn));
   unshared->refcnt++;
   SLP_INSTANCE_TREE (slp_instn) = unshared;
   FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node)
@@ -2080,12 +2006,12 @@ vect_analyze_slp_instance (vec_info *vinfo,
                                 "Build SLP failed: store group "
                                 "size not a multiple of the vector size "
                                 "in basic block SLP\n");
-             vect_free_slp_tree (node, false);
+             vect_free_slp_tree (node);
              return false;
            }
          /* Fatal mismatch.  */
          matches[group_size / const_max_nunits * const_max_nunits] = false;
-         vect_free_slp_tree (node, false);
+         vect_free_slp_tree (node);
        }
       else
        {
@@ -2143,7 +2069,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
                    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                                     "Built SLP cancelled: can use "
                                     "load/store-lanes\n");
-                 vect_free_slp_instance (new_instance, false);
+                 vect_free_slp_instance (new_instance);
                  return false;
                }
            }
@@ -2169,6 +2095,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
              for (unsigned i = 0; i < group_size; ++i)
                scalar_stmts.quick_push (next_info);
              slp_tree conv = vect_create_new_slp_node (scalar_stmts, 1);
+             SLP_TREE_VECTYPE (conv) = STMT_VINFO_VECTYPE (next_info);
              SLP_TREE_CHILDREN (conv).quick_push (node);
              SLP_INSTANCE_TREE (new_instance) = conv;
              /* We also have to fake this conversion stmt as SLP reduction
@@ -2302,7 +2229,7 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size)
   for (scalar_stmts_to_slp_tree_map_t::iterator it = bst_map->begin ();
        it != bst_map->end (); ++it)
     if ((*it).second)
-      vect_free_slp_tree ((*it).second, false);
+      vect_free_slp_tree ((*it).second);
   delete bst_map;
 
   /* Optimize permutations in SLP reductions.  */
@@ -2583,6 +2510,47 @@ _bb_vec_info::~_bb_vec_info ()
   bb->aux = NULL;
 }
 
+/* Push NODEs vectype to the participating stmts and save the original
+   recorded ones in SAVED.  */
+
+void
+vect_slp_push_vectype (slp_tree node, vec<tree> *saved)
+{
+  stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
+  if (STMT_VINFO_GROUPED_ACCESS (stmt_info))
+    {
+      for (stmt_vec_info s = DR_GROUP_FIRST_ELEMENT (stmt_info);
+          s; s = DR_GROUP_NEXT_ELEMENT (s))
+       {
+         saved->safe_push (STMT_VINFO_VECTYPE (s));
+         STMT_VINFO_VECTYPE (s) = SLP_TREE_VECTYPE (node);
+       }
+    }
+  else
+    {
+      saved->safe_push (STMT_VINFO_VECTYPE (stmt_info));
+      STMT_VINFO_VECTYPE (stmt_info) = SLP_TREE_VECTYPE (node);
+    }
+}
+
+/* Restore vectypes from SAVED to the participating stmts of NODE.  */
+
+void
+vect_slp_pop_vectype (slp_tree node, vec<tree> *saved)
+{
+  stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
+  if (STMT_VINFO_GROUPED_ACCESS (stmt_info))
+    {
+      unsigned i = 0;
+      for (stmt_vec_info s = DR_GROUP_FIRST_ELEMENT (stmt_info);
+          s; s = DR_GROUP_NEXT_ELEMENT (s))
+       STMT_VINFO_VECTYPE (s) = (*saved)[i++];
+      saved->truncate (0);
+    }
+  else
+    STMT_VINFO_VECTYPE (stmt_info) = saved->pop ();
+}
+
 /* Subroutine of vect_slp_analyze_node_operations.  Handle the root of NODE,
    given then that child nodes have already been processed, and that
    their def types currently match their SLP node's def type.  */
@@ -2620,14 +2588,19 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, 
slp_tree node,
       else
        vf = 1;
       unsigned int group_size = SLP_TREE_LANES (node);
-      tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+      tree vectype = SLP_TREE_VECTYPE (node);
       SLP_TREE_NUMBER_OF_VEC_STMTS (node)
        = vect_get_num_vectors (vf * group_size, vectype);
     }
 
+  auto_vec<tree, 1> saved_vectypes;
+  vect_slp_push_vectype (node, &saved_vectypes);
   bool dummy;
-  return vect_analyze_stmt (vinfo, stmt_info, &dummy,
-                           node, node_instance, cost_vec);
+  bool ok = vect_analyze_stmt (vinfo, stmt_info, &dummy,
+                              node, node_instance, cost_vec);
+  vect_slp_pop_vectype (node, &saved_vectypes);
+
+  return ok;
 }
 
 /* Try to build NODE from scalars, returning true on success.
@@ -2840,7 +2813,7 @@ vect_slp_analyze_operations (vec_info *vinfo)
            dump_printf_loc (MSG_NOTE, vect_location,
                             "removing SLP instance operations starting from: 
%G",
                             stmt_info->stmt);
-         vect_free_slp_instance (instance, false);
+         vect_free_slp_instance (instance);
           vinfo->slp_instances.ordered_remove (i);
          cost_vec.release ();
        }
@@ -3133,7 +3106,7 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int n_stmts, 
bool &fatal)
            dump_printf_loc (MSG_NOTE, vect_location,
                             "removing SLP instance operations starting from: 
%G",
                             stmt_info->stmt);
-         vect_free_slp_instance (instance, false);
+         vect_free_slp_instance (instance);
          BB_VINFO_SLP_INSTANCES (bb_vinfo).ordered_remove (i);
          continue;
        }
@@ -3961,9 +3934,11 @@ vect_schedule_slp_instance (vec_info *vinfo,
     vect_schedule_slp_instance (vinfo, child, instance);
 
   stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
+  auto_vec<tree, 1> saved_vectypes;
+  vect_slp_push_vectype (node, &saved_vectypes);
 
   /* VECTYPE is the type of the destination.  */
-  tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+  tree vectype = SLP_TREE_VECTYPE (node);
   poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype);
   unsigned group_size = SLP_TREE_SCALAR_STMTS (node).length ();
 
@@ -4058,6 +4033,7 @@ vect_schedule_slp_instance (vec_info *vinfo,
     }
   if (!done_p)
     vect_transform_stmt (vinfo, stmt_info, &si, node, instance);
+  vect_slp_pop_vectype (node, &saved_vectypes);
 }
 
 /* Replace scalar calls from SLP node NODE with setting of their lhs to zero.
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 71ee83176c5..d8d45fe2d7a 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -11219,15 +11219,18 @@ vect_is_simple_use (vec_info *vinfo, stmt_vec_info 
stmt, slp_tree slp_node,
     {
       slp_tree child = SLP_TREE_CHILDREN (slp_node)[operand];
       *slp_def = child;
+      *vectype = SLP_TREE_VECTYPE (child);
       if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
-       *op = gimple_get_lhs (SLP_TREE_REPRESENTATIVE (child)->stmt);
+       {
+         *op = gimple_get_lhs (SLP_TREE_REPRESENTATIVE (child)->stmt);
+         return vect_is_simple_use (*op, vinfo, dt, def_stmt_info_out);
+       }
       else
        {
          if (def_stmt_info_out)
            *def_stmt_info_out = NULL;
          *op = SLP_TREE_SCALAR_OPS (child)[0];
          *dt = SLP_TREE_DEF_TYPE (child);
-         *vectype = SLP_TREE_VECTYPE (child);
          return true;
        }
     }
@@ -11258,11 +11261,8 @@ vect_is_simple_use (vec_info *vinfo, stmt_vec_info 
stmt, slp_tree slp_node,
        }
       else
        gcc_unreachable ();
+      return vect_is_simple_use (*op, vinfo, dt, vectype, def_stmt_info_out);
     }
-
-  /* ???  We might want to update *vectype from *slp_def here though
-     when sharing nodes this would prevent unsharing in the caller.  */
-  return vect_is_simple_use (*op, vinfo, dt, vectype, def_stmt_info_out);
 }
 
 /* If OP is not NULL and is external or constant update its vector
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 76cfba5d497..e4da1dd784f 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -473,7 +473,7 @@ vec_info::~vec_info ()
   unsigned int i;
 
   FOR_EACH_VEC_ELT (slp_instances, i, instance)
-    vect_free_slp_instance (instance, true);
+    vect_free_slp_instance (instance);
 
   destroy_cost_data (target_cost_data);
   free_stmt_vec_infos ();
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 828a54104a6..ac361dd6c93 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1101,9 +1101,6 @@ public:
   /* Whether on this stmt reduction meta is recorded.  */
   bool is_reduc_info;
 
-  /* The number of scalar stmt references from active SLP instances.  */
-  unsigned int num_slp_uses;
-
   /* If nonzero, the lhs of the statement could be truncated to this
      many bits without affecting any users of the result.  */
   unsigned int min_output_precision;
@@ -1218,7 +1215,6 @@ struct gather_scatter_info {
 #define STMT_VINFO_LOOP_PHI_EVOLUTION_BASE_UNCHANGED(S) 
(S)->loop_phi_evolution_base_unchanged
 #define STMT_VINFO_LOOP_PHI_EVOLUTION_PART(S) (S)->loop_phi_evolution_part
 #define STMT_VINFO_MIN_NEG_DIST(S)     (S)->min_neg_dist
-#define STMT_VINFO_NUM_SLP_USES(S)     (S)->num_slp_uses
 #define STMT_VINFO_REDUC_TYPE(S)       (S)->reduc_type
 #define STMT_VINFO_REDUC_CODE(S)       (S)->reduc_code
 #define STMT_VINFO_REDUC_FN(S)         (S)->reduc_fn
@@ -1898,7 +1894,7 @@ extern int vect_get_known_peeling_cost (loop_vec_info, 
int, int *,
 extern tree cse_and_gimplify_to_preheader (loop_vec_info, tree);
 
 /* In tree-vect-slp.c.  */
-extern void vect_free_slp_instance (slp_instance, bool);
+extern void vect_free_slp_instance (slp_instance);
 extern bool vect_transform_slp_perm_load (vec_info *, slp_tree, vec<tree>,
                                          gimple_stmt_iterator *, poly_uint64,
                                          bool, unsigned *);
@@ -1920,6 +1916,8 @@ extern bool can_duplicate_and_interleave_p (vec_info *, 
unsigned int, tree,
 extern void duplicate_and_interleave (vec_info *, gimple_seq *, tree,
                                      vec<tree>, unsigned int, vec<tree> &);
 extern int vect_get_place_in_interleaving_chain (stmt_vec_info, stmt_vec_info);
+extern void vect_slp_push_vectype (slp_tree, vec<tree> *);
+extern void vect_slp_pop_vectype (slp_tree, vec<tree> *);
 
 /* In tree-vect-patterns.c.  */
 /* Pattern recognition functions.
-- 
2.26.2

Reply via email to