Instruments those things that needed to be instrumented
in order to develop predicated tails for basic block
SLP (superword-level parallelism).
---
 gcc/tree-vect-loop.cc  | 10 ++++++++++
 gcc/tree-vect-slp.cc   |  6 ++++++
 gcc/tree-vect-stmts.cc | 31 ++++++++++++++++++++++++++++++-
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 49ccff62c9a..2de7fd53ef6 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -907,6 +907,11 @@ vect_get_max_nscalars_per_iter (loop_vec_info loop_vinfo)
   rgroup_controls *rgm;
   FOR_EACH_VEC_ELT (LOOP_VINFO_MASKS (loop_vinfo).rgc_vec, i, rgm)
     res = MAX (res, rgm->max_nscalars_per_iter);
+
+  if (dump_enabled_p ())
+    dump_printf_loc (MSG_NOTE, vect_location, "max_nscalars_per_iter=%u\n",
+                    res);
+
   return res;
 }
 
@@ -1015,6 +1020,11 @@ vect_verify_full_masking (loop_vec_info loop_vinfo)
       unsigned int nscalars_per_iter
          = exact_div (nvectors * TYPE_VECTOR_SUBPARTS (vectype),
                       LOOP_VINFO_VECT_FACTOR (loop_vinfo)).to_constant ();
+      if (dump_enabled_p ())
+       dump_printf_loc (
+         MSG_NOTE, vect_location,
+         "verify_full_masking: nvectors=%u, nscalars_per_iter=%u\n", nvectors,
+         nscalars_per_iter);
 
       if (rgm->max_nscalars_per_iter < nscalars_per_iter)
        {
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index f5cf437014e..8bc43961e49 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -8634,6 +8634,12 @@ vect_prologue_cost_for_slp (vec_info *vinfo, slp_tree 
node,
      When all elements are the same we can use a splat.  */
   tree vectype = SLP_TREE_VECTYPE (node);
   unsigned group_size = SLP_TREE_SCALAR_OPS (node).length ();
+  if (dump_enabled_p ())
+    dump_printf_loc (MSG_NOTE, vect_location,
+                    "vect_prologue_cost_for_slp: node %p, vector type %T, "
+                    "group_size %u\n",
+                    (void *) node, vectype, group_size);
+
   unsigned HOST_WIDE_INT const_nunits;
   unsigned nelt_limit;
   unsigned nvectors = vect_get_num_copies (vinfo, node);
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index ddf2f90e8d3..36f73b0420a 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -5429,7 +5429,12 @@ vectorizable_conversion (vec_info *vinfo,
   /* If op0 is an external or constant def, infer the vector type
      from the scalar type.  */
   if (!vectype_in)
-    vectype_in = get_vectype_for_scalar_type (vinfo, rhs_type, slp_node);
+    {
+      vectype_in = get_vectype_for_scalar_type (vinfo, rhs_type, slp_node);
+      if (dump_enabled_p ())
+       dump_printf_loc (MSG_NOTE, vect_location, "inferred vector type %T\n",
+                        vectype_in);
+    }
 
   if (!cost_vec)
     gcc_assert (vectype_in);
@@ -12416,6 +12421,9 @@ vectorizable_comparison_1 (vec_info *vinfo, tree 
vectype,
   if (!vectype)
     {
       vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs1), 
slp_node);
+      if (dump_enabled_p ())
+       dump_printf_loc (MSG_NOTE, vect_location,
+                        "invariant comparison, guessed type %T.\n", vectype);
       if (!vectype || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), nunits))
        return false;
     }
@@ -13346,7 +13354,19 @@ get_vectype_for_scalar_type (vec_info *vinfo, tree 
scalar_type,
   /* Register the natural choice of vector type, before the group size
      has been applied.  */
   if (vectype)
+  {
+    if (dump_enabled_p ())
+      dump_printf_loc (MSG_NOTE, vect_location,
+                      "get_vectype_for_scalar_type: natural type for %T "
+                      "(ignoring group size %u): %T\n",
+                      scalar_type, group_size, vectype);
     vinfo->used_vector_modes.add (TYPE_MODE (vectype));
+  }
+  else if (dump_enabled_p ())
+    dump_printf_loc (MSG_NOTE, vect_location,
+                    "get_vectype_for_scalar_type: no natural type for %T "
+                    "(ignoring group size %u)\n",
+                    scalar_type, group_size);
 
   /* If the natural choice of vector type doesn't satisfy GROUP_SIZE,
      try again with an explicit number of elements.  A vector type satisfies
@@ -13379,6 +13399,11 @@ get_vectype_for_scalar_type (vec_info *vinfo, tree 
scalar_type,
        {
          vectype = get_related_vectype_for_scalar_type (vinfo->vector_mode,
                                                         scalar_type, nunits);
+         if (dump_enabled_p ())
+           dump_printf_loc (MSG_NOTE, vect_location,
+                            "get_vectype_for_scalar_type: trying %u elements "
+                            "of type %T: %T\n",
+                            nunits, scalar_type, vectype);
          nunits /= 2;
        }
       while (nunits > 1 && !vectype);
@@ -13714,6 +13739,10 @@ vect_maybe_update_slp_op_vectype (vec_info *vinfo, 
slp_tree op, tree vectype)
     }
 
   SLP_TREE_VECTYPE (op) = vectype;
+  if (dump_enabled_p ())
+      dump_printf_loc (MSG_NOTE, vect_location,
+                      "updated vectype of operand %p with %u lanes to %T\n",
+                      (void *) op, SLP_TREE_LANES (op), vectype);
   return true;
 }
 
-- 
2.43.0

Reply via email to