Update all callers to pass a pointer to the vectorizer state
into this helper function. Its value is temporarily unused
but will be required for BB SLP with predicated tails.
---
gcc/tree-vect-loop.cc | 18 +++++++-------
gcc/tree-vect-slp.cc | 2 +-
gcc/tree-vect-stmts.cc | 56 ++++++++++++++++++++++--------------------
gcc/tree-vectorizer.h | 2 +-
4 files changed, 40 insertions(+), 38 deletions(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 50cdc2a90fa..49ccff62c9a 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -6797,7 +6797,7 @@ vectorizable_lane_reducing (loop_vec_info loop_vinfo,
stmt_vec_info stmt_info,
return false;
}
- if (!vect_maybe_update_slp_op_vectype (slp_op, vectype))
+ if (!vect_maybe_update_slp_op_vectype (loop_vinfo, slp_op, vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6934,7 +6934,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
unsigned j;
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child)
- if (!vect_maybe_update_slp_op_vectype (child,
+ if (!vect_maybe_update_slp_op_vectype (loop_vinfo, child,
SLP_TREE_VECTYPE (slp_node)))
{
if (dump_enabled_p ())
@@ -7052,7 +7052,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
vectype_op = get_vectype_for_scalar_type (loop_vinfo,
type_op);
if (!vectype_op
- || !vect_maybe_update_slp_op_vectype (op_node,
+ || !vect_maybe_update_slp_op_vectype (loop_vinfo, op_node,
vectype_op))
return false;
}
@@ -7739,7 +7739,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
if (single_defuse_cycle || reduction_type == FOLD_LEFT_REDUCTION)
for (i = 0; i < (int) op.num_ops; i++)
- if (!vect_maybe_update_slp_op_vectype (slp_op[i], vectype_op[i]))
+ if (!vect_maybe_update_slp_op_vectype (loop_vinfo, slp_op[i],
vectype_op[i]))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -8432,7 +8432,7 @@ vectorizable_lc_phi (loop_vec_info loop_vinfo,
/* Deal with copies from externs or constants that disguise as
loop-closed PHI nodes (PR97886). */
- if (!vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
+ if (!vect_maybe_update_slp_op_vectype (loop_vinfo, SLP_TREE_CHILDREN
(slp_node)[0],
SLP_TREE_VECTYPE (slp_node)))
{
if (dump_enabled_p ())
@@ -8508,7 +8508,7 @@ vectorizable_phi (bb_vec_info vinfo,
"PHI node with unvectorized backedge def\n");
return false;
}
- else if (!vect_maybe_update_slp_op_vectype (child, vectype))
+ else if (!vect_maybe_update_slp_op_vectype (vinfo, child, vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -8697,7 +8697,7 @@ vectorizable_recurr (loop_vec_info loop_vinfo,
stmt_vec_info stmt_info,
unsigned j;
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child)
- if (!vect_maybe_update_slp_op_vectype (child, vectype))
+ if (!vect_maybe_update_slp_op_vectype (loop_vinfo, child, vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -9557,8 +9557,8 @@ vectorizable_induction (loop_vec_info loop_vinfo,
unsigned j;
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child)
- if (!vect_maybe_update_slp_op_vectype
- (child, SLP_TREE_VECTYPE (slp_node)))
+ if (!vect_maybe_update_slp_op_vectype (loop_vinfo, child,
+ SLP_TREE_VECTYPE (slp_node)))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 742db196438..4e5f6bc8083 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -11402,7 +11402,7 @@ vectorizable_slp_permutation_1 (vec_info *vinfo,
gimple_stmt_iterator *gsi,
FOR_EACH_VEC_ELT (children, i, child)
{
if ((SLP_TREE_DEF_TYPE (child) != vect_internal_def
- && !vect_maybe_update_slp_op_vectype (child, op_vectype))
+ && !vect_maybe_update_slp_op_vectype (vinfo, child, op_vectype))
|| !types_compatible_p (SLP_TREE_VECTYPE (child), op_vectype)
|| !types_compatible_p (TREE_TYPE (vectype), TREE_TYPE (op_vectype)))
{
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index f9905652295..10cfe0dc06d 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -3412,7 +3412,7 @@ vectorizable_bswap (vec_info *vinfo,
if (cost_vec)
{
- if (!vect_maybe_update_slp_op_vectype (slp_op[0], vectype_in))
+ if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op[0], vectype_in))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -3746,7 +3746,7 @@ vectorizable_call (vec_info *vinfo,
if (cost_vec) /* transformation not required. */
{
for (i = 0; i < nargs; ++i)
- if (!vect_maybe_update_slp_op_vectype (slp_op[i],
+ if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op[i],
vectypes[i]
? vectypes[i] : vectype_in))
{
@@ -4486,7 +4486,7 @@ vectorizable_simd_clone_call (vec_info *vinfo,
stmt_vec_info stmt_info,
if (cost_vec) /* transformation not required. */
{
for (unsigned i = 0; i < nargs; ++i)
- if (!vect_maybe_update_slp_op_vectype (slp_op[i], arginfo[i].vectype))
+ if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op[i],
arginfo[i].vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5669,8 +5669,8 @@ vectorizable_conversion (vec_info *vinfo,
if (cost_vec) /* transformation not required. */
{
- if (!vect_maybe_update_slp_op_vectype (slp_op0, vectype_in)
- || !vect_maybe_update_slp_op_vectype (slp_op1, vectype_in))
+ if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op0, vectype_in)
+ || !vect_maybe_update_slp_op_vectype (vinfo, slp_op1, vectype_in))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6023,7 +6023,7 @@ vectorizable_assignment (vec_info *vinfo,
if (cost_vec) /* transformation not required. */
{
- if (!vect_maybe_update_slp_op_vectype (slp_op, vectype_in))
+ if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op, vectype_in))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6351,13 +6351,13 @@ vectorizable_shift (vec_info *vinfo,
if (cost_vec) /* transformation not required. */
{
- if (!vect_maybe_update_slp_op_vectype (slp_op0, vectype)
+ if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op0, vectype)
|| ((!scalar_shift_arg || dt[1] == vect_internal_def)
- && (!incompatible_op1_vectype_p
- || dt[1] == vect_constant_def)
- && !vect_maybe_update_slp_op_vectype
- (slp_op1,
- incompatible_op1_vectype_p ? vectype : op1_vectype)))
+ && (!incompatible_op1_vectype_p || dt[1] == vect_constant_def)
+ && !vect_maybe_update_slp_op_vectype (vinfo, slp_op1,
+ incompatible_op1_vectype_p
+ ? vectype
+ : op1_vectype)))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6782,9 +6782,9 @@ vectorizable_operation (vec_info *vinfo,
}
/* Put types on constant and invariant SLP children. */
- if (!vect_maybe_update_slp_op_vectype (slp_op0, vectype)
- || !vect_maybe_update_slp_op_vectype (slp_op1, vectype)
- || !vect_maybe_update_slp_op_vectype (slp_op2, vectype))
+ if (!vect_maybe_update_slp_op_vectype (vinfo, slp_op0, vectype)
+ || !vect_maybe_update_slp_op_vectype (vinfo, slp_op1, vectype)
+ || !vect_maybe_update_slp_op_vectype (vinfo, slp_op2, vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -8253,9 +8253,9 @@ vectorizable_store (vec_info *vinfo,
vls_type, group_size, &ls,
mask_node);
- if (!vect_maybe_update_slp_op_vectype (op_node, vectype)
+ if (!vect_maybe_update_slp_op_vectype (vinfo, op_node, vectype)
|| (mask_node
- && !vect_maybe_update_slp_op_vectype (mask_node,
+ && !vect_maybe_update_slp_op_vectype (vinfo, mask_node,
mask_vectype)))
{
if (dump_enabled_p ())
@@ -8682,7 +8682,7 @@ vectorizable_store (vec_info *vinfo,
above only handles the mask and the first store operand node. */
for (slp_tree child : SLP_TREE_CHILDREN (slp_node))
if (child != mask_node
- && !vect_maybe_update_slp_op_vectype (child, vectype))
+ && !vect_maybe_update_slp_op_vectype (vinfo, child, vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -9815,7 +9815,7 @@ vectorizable_load (vec_info *vinfo,
if (costing_p) /* transformation not required. */
{
if (mask_node
- && !vect_maybe_update_slp_op_vectype (mask_node,
+ && !vect_maybe_update_slp_op_vectype (vinfo, mask_node,
mask_vectype))
{
if (dump_enabled_p ())
@@ -12023,13 +12023,14 @@ vectorizable_condition (vec_info *vinfo,
|| !expand_vec_cond_expr_p (vectype, vec_cmp_type))))
return false;
- if (!vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
+ if (!vect_maybe_update_slp_op_vectype (vinfo,
+ SLP_TREE_CHILDREN (slp_node)[0],
comp_vectype)
|| (op_adjust == 1
- && !vect_maybe_update_slp_op_vectype
- (SLP_TREE_CHILDREN (slp_node)[1], comp_vectype))
- || !vect_maybe_update_slp_op_vectype (then_slp_node, vectype)
- || !vect_maybe_update_slp_op_vectype (else_slp_node, vectype))
+ && !vect_maybe_update_slp_op_vectype (
+ vinfo, SLP_TREE_CHILDREN (slp_node)[1], comp_vectype))
+ || !vect_maybe_update_slp_op_vectype (vinfo, then_slp_node, vectype)
+ || !vect_maybe_update_slp_op_vectype (vinfo, else_slp_node, vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -12470,8 +12471,8 @@ vectorizable_comparison_1 (vec_info *vinfo, tree
vectype,
}
/* Put types on constant and invariant SLP children. */
- if (!vect_maybe_update_slp_op_vectype (slp_rhs1, vectype)
- || !vect_maybe_update_slp_op_vectype (slp_rhs2, vectype))
+ if (!vect_maybe_update_slp_op_vectype (vinfo, slp_rhs1, vectype)
+ || !vect_maybe_update_slp_op_vectype (vinfo, slp_rhs2, vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -13623,7 +13624,7 @@ vect_is_simple_use (vec_info *vinfo, slp_tree slp_node,
for example when conflicting vector types are present. */
bool
-vect_maybe_update_slp_op_vectype (slp_tree op, tree vectype)
+vect_maybe_update_slp_op_vectype (vec_info *vinfo, slp_tree op, tree vectype)
{
if (!op || SLP_TREE_DEF_TYPE (op) == vect_internal_def)
return true;
@@ -13637,6 +13638,7 @@ vect_maybe_update_slp_op_vectype (slp_tree op, tree
vectype)
&& SLP_TREE_DEF_TYPE (op) == vect_external_def
&& SLP_TREE_LANES (op) > 1)
return false;
+ (void) vinfo; // FORNOW
SLP_TREE_VECTYPE (op) = vectype;
return true;
}
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 708ce783db7..ab9ed09d62b 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -2535,7 +2535,7 @@ extern bool vect_is_simple_use (vec_info *, slp_tree,
unsigned, tree *, slp_tree *,
enum vect_def_type *,
tree *, stmt_vec_info * = NULL);
-extern bool vect_maybe_update_slp_op_vectype (slp_tree, tree);
+extern bool vect_maybe_update_slp_op_vectype (vec_info *, slp_tree, tree);
extern tree perm_mask_for_reverse (tree);
extern bool supportable_widening_operation (vec_info*, code_helper,
stmt_vec_info, tree, tree,
--
2.43.0