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 00b21ecfc95..3b48b53182b 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -6833,7 +6833,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,
@@ -6970,7 +6970,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 ())
@@ -7088,7 +7088,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;
}
@@ -7777,7 +7777,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,
@@ -8482,7 +8483,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 ())
@@ -8558,7 +8560,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,
@@ -8747,7 +8749,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,
@@ -9624,8 +9626,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 dae6b9cdaaf..103871e8780 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -11514,7 +11514,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 dbca9ea3af2..7ed37aeb398 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -3458,7 +3458,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,
@@ -3793,7 +3793,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))
{
@@ -4494,7 +4494,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,
@@ -5750,8 +5751,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,
@@ -6104,7 +6105,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,
@@ -6432,13 +6433,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,
@@ -6863,9 +6864,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,
@@ -8340,9 +8341,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 ())
@@ -8769,7 +8770,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,
@@ -9934,7 +9935,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 ())
@@ -12278,13 +12279,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,
@@ -12725,8 +12727,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,
@@ -13906,7 +13908,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;
@@ -13920,6 +13922,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 a4337035417..26d9afe69ba 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -2507,7 +2507,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 (code_helper, tree, tree, bool,
code_helper*, code_helper*,
--
2.43.0