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/ChangeLog:
* tree-vect-loop.cc (vectorizable_lane_reducing): Pass
loop_vinfo to vect_maybe_update_slp_op_vectype.
(vectorizable_reduction): As above.
(vectorizable_lc_phi): As above.
(vectorizable_phi): Pass vinfo to
vect_maybe_update_slp_op_vectype.
(vectorizable_recurr): Pass loop_vinfo to
vect_maybe_update_slp_op_vectype.
(vectorizable_induction): As above.
* tree-vect-slp.cc (vectorizable_slp_permutation_1): Pass vinfo
to vect_maybe_update_slp_op_vectype.
* tree-vect-stmts.cc (vectorizable_bswap): As above.
(vectorizable_call): As above.
(vectorizable_simd_clone_call): As above.
(vectorizable_conversion): As above.
(vectorizable_assignment): As above.
(vectorizable_shift): As above.
(vectorizable_operation): As above.
(vectorizable_store): As above.
(vectorizable_load): As above.
(vectorizable_condition): As above.
(vectorizable_comparison_1): As above.
(vect_maybe_update_slp_op_vectype): Update definition to accept
a parameter of type vec_info *.
* tree-vectorizer.h (vect_maybe_update_slp_op_vectype): Update
declaration to accept a parameter of type vec_info *.
---
gcc/tree-vect-loop.cc | 20 ++++++++-------
gcc/tree-vect-slp.cc | 2 +-
gcc/tree-vect-stmts.cc | 57 ++++++++++++++++++++++--------------------
gcc/tree-vectorizer.h | 2 +-
4 files changed, 43 insertions(+), 38 deletions(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index e013d4f9809..91407939a89 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -6778,7 +6778,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,
@@ -6915,7 +6915,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 ())
@@ -7033,7 +7033,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;
}
@@ -7722,7 +7722,8 @@ 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,
@@ -8427,7 +8428,8 @@ 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 ())
@@ -8503,7 +8505,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,
@@ -8692,7 +8694,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,
@@ -9552,8 +9554,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 244b0c52c48..4bb731a6658 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -11550,7 +11550,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 6dcd9ea0636..0b4a081a211 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -3489,7 +3489,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,
@@ -3824,7 +3824,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))
{
@@ -4573,7 +4573,8 @@ 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,
@@ -5766,8 +5767,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,
@@ -6120,7 +6121,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,
@@ -6448,13 +6449,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,
@@ -6879,9 +6880,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,
@@ -8350,9 +8351,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 ())
@@ -8779,7 +8780,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,
@@ -9944,7 +9945,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 ())
@@ -12252,13 +12253,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,
@@ -12699,8 +12701,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,
@@ -13852,7 +13854,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;
@@ -13866,6 +13868,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 0924a980591..9f0354093ff 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -2536,7 +2536,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