This makes them get a stmt_vec_info, eliding the separate gather-scatter
flag argument.
* tree-vectorizer.h (vect_slp_child_index_for_operand): Get
a stmt_vec_info, elide gather-scatter flag.
* tree-vect-stmts.cc (vect_check_store_rhs): Adjust.
(vectorizable_simd_clone_call): Likewise.
(vectorizable_store): Likewise.
(vectorizable_load): Likewise.
* tree-vect-slp.cc (vect_get_operand_map): New overload
with a stmt_vec_info argument.
(vect_slp_child_index_for_operand): Adjust.
(vect_get_and_check_slp_defs): Likewise.
(compatible_calls_p): Likewise.
(vect_build_slp_tree_2): Likewise.
---
gcc/tree-vect-slp.cc | 26 ++++++++++++++------------
gcc/tree-vect-stmts.cc | 17 ++++++-----------
gcc/tree-vectorizer.h | 2 +-
3 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index ccb7e8d6dde..9d249f5fe4e 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -532,8 +532,8 @@ vect_def_types_match (enum vect_def_type dta, enum
vect_def_type dtb)
SWAP is as for vect_get_and_check_slp_defs. */
static const int *
-vect_get_operand_map (const gimple *stmt, bool gather_scatter_p = false,
- unsigned char swap = 0)
+vect_get_operand_map (const gimple *stmt, bool gather_scatter_p,
+ unsigned char swap)
{
static const int no_arg_map[] = { 0 };
static const int arg0_map[] = { 1, 0 };
@@ -629,13 +629,19 @@ vect_get_operand_map (const gimple *stmt, bool
gather_scatter_p = false,
return nullptr;
}
+static const int *
+vect_get_operand_map (const stmt_vec_info stmt, unsigned char swap = 0)
+{
+ return vect_get_operand_map (stmt->stmt, STMT_VINFO_GATHER_SCATTER_P (stmt),
+ swap);
+}
+
/* Return the SLP node child index for operand OP of STMT. */
int
-vect_slp_child_index_for_operand (const gimple *stmt, int op,
- bool gather_scatter_p)
+vect_slp_child_index_for_operand (const stmt_vec_info stmt, int op)
{
- const int *opmap = vect_get_operand_map (stmt, gather_scatter_p);
+ const int *opmap = vect_get_operand_map (stmt);
if (!opmap)
return op;
for (int i = 1; i < 1 + opmap[0]; ++i)
@@ -687,9 +693,7 @@ vect_get_and_check_slp_defs (vec_info *vinfo, tree vectype,
unsigned char swap,
return -1;
number_of_oprnds = gimple_num_args (stmt_info->stmt);
- const int *map
- = vect_get_operand_map (stmt_info->stmt,
- STMT_VINFO_GATHER_SCATTER_P (stmt_info), swap);
+ const int *map = vect_get_operand_map (stmt_info, swap);
if (map)
number_of_oprnds = *map++;
if (gcall *stmt = dyn_cast <gcall *> (stmt_info->stmt))
@@ -1045,7 +1049,7 @@ compatible_calls_p (gcall *call1, gcall *call2, bool
allow_two_operators)
}
/* Check that any unvectorized arguments are equal. */
- if (const int *map = vect_get_operand_map (call1))
+ if (const int *map = vect_get_operand_map (call1, false, false))
{
unsigned int nkept = *map++;
unsigned int mapi = 0;
@@ -2000,9 +2004,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
return NULL;
nops = gimple_num_args (stmt_info->stmt);
- if (const int *map = vect_get_operand_map (stmt_info->stmt,
- STMT_VINFO_GATHER_SCATTER_P
- (stmt_info)))
+ if (const int *map = vect_get_operand_map (stmt_info))
nops = map[0];
/* If the SLP node is a PHI (induction or reduction), terminate
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 22285250aa8..2c3214cc196 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -2826,8 +2826,7 @@ vect_check_store_rhs (vec_info *vinfo, stmt_vec_info
stmt_info,
&& internal_store_fn_p (gimple_call_internal_fn (call)))
op_no = internal_fn_stored_value_index (gimple_call_internal_fn (call));
}
- op_no = vect_slp_child_index_for_operand
- (stmt_info->stmt, op_no, STMT_VINFO_GATHER_SCATTER_P (stmt_info));
+ op_no = vect_slp_child_index_for_operand (stmt_info, op_no);
enum vect_def_type rhs_dt;
tree rhs_vectype;
@@ -4152,9 +4151,8 @@ vectorizable_simd_clone_call (vec_info *vinfo,
stmt_vec_info stmt_info,
thisarginfo.op = NULL_TREE;
thisarginfo.simd_lane_linear = false;
- int op_no = vect_slp_child_index_for_operand (stmt,
- i + masked_call_offset,
- false);
+ int op_no = vect_slp_child_index_for_operand (stmt_info,
+ i + masked_call_offset);
if (!vect_is_simple_use (vinfo, slp_node,
op_no, &op, &slp_op[i],
&thisarginfo.dt, &thisarginfo.vectype)
@@ -8169,8 +8167,7 @@ vectorizable_store (vec_info *vinfo,
int mask_index = internal_fn_mask_index (ifn);
if (mask_index >= 0)
- mask_index = vect_slp_child_index_for_operand
- (call, mask_index, STMT_VINFO_GATHER_SCATTER_P (stmt_info));
+ mask_index = vect_slp_child_index_for_operand (stmt_info, mask_index);
if (mask_index >= 0
&& !vect_check_scalar_mask (vinfo, slp_node, mask_index,
&mask_node, &mask_dt,
@@ -9755,8 +9752,7 @@ vectorizable_load (vec_info *vinfo,
mask_index = internal_fn_mask_index (ifn);
if (mask_index >= 0)
- mask_index = vect_slp_child_index_for_operand
- (call, mask_index, STMT_VINFO_GATHER_SCATTER_P (stmt_info));
+ mask_index = vect_slp_child_index_for_operand (stmt_info, mask_index);
if (mask_index >= 0
&& !vect_check_scalar_mask (vinfo, slp_node, mask_index,
&mask_node, &mask_dt, &mask_vectype))
@@ -9764,8 +9760,7 @@ vectorizable_load (vec_info *vinfo,
els_index = internal_fn_else_index (ifn);
if (els_index >= 0)
- els_index = vect_slp_child_index_for_operand
- (call, els_index, STMT_VINFO_GATHER_SCATTER_P (stmt_info));
+ els_index = vect_slp_child_index_for_operand (stmt_info, els_index);
if (els_index >= 0
&& !vect_is_simple_use (vinfo, slp_node, els_index,
&els, &els_op, &els_dt, &els_vectype))
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index bde164301a8..9a4126e0cec 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -2776,7 +2776,7 @@ extern int vect_get_place_in_interleaving_chain
(stmt_vec_info, stmt_vec_info);
extern slp_tree vect_create_new_slp_node (unsigned, tree_code);
extern void vect_free_slp_tree (slp_tree);
extern bool compatible_calls_p (gcall *, gcall *, bool);
-extern int vect_slp_child_index_for_operand (const gimple *, int op, bool);
+extern int vect_slp_child_index_for_operand (const stmt_vec_info, int op);
extern tree prepare_vec_mask (loop_vec_info, tree, tree, tree,
gimple_stmt_iterator *);
--
2.51.0