aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-07-25 12:34:44 +0200
committerRichard Biener <rguenther@suse.de>2025-07-25 14:20:22 +0200
commitfe3069ae2386ca48614dc627accec20b3fcfe722 (patch)
tree5d095e06feec90833f93c091a74f515a5018417e /gcc
parentc2bb709a9cd580309016ed95b6e2abc9cb7a26e8 (diff)
downloadgcc-fe3069ae2386ca48614dc627accec20b3fcfe722.zip
gcc-fe3069ae2386ca48614dc627accec20b3fcfe722.tar.gz
gcc-fe3069ae2386ca48614dc627accec20b3fcfe722.tar.bz2
Reduce the number of STMT_VINFO_VECTYPE uses
The following adjusts uses of STMT_VINFO_VECTYPE to look elsewhere where obvious. * tree-vect-loop.cc (vect_analyze_loop_2): Get vectype from the SLP node. (vectorize_fold_left_reduction): Likewise. (vect_transform_reduction): Likewise. (vect_transform_cycle_phi): Likewise. (vect_transform_lc_phi): Likewise. * tree-vect-slp.cc (vect_analyze_slp): Likewise. * tree-vect-stmts.cc (vect_truncate_gather_scatter_offset): Pass in vectype and use that. (vect_use_strided_gather_scatters_p): Likewise. (get_group_load_store_type): Adjust. (vect_check_scalar_mask): We always have a SLP node. Use vectype from the SLP node. (vect_check_store_rhs): Likewise. (vect_build_one_gather_load_call): Pass in the vector type and use that. (vect_get_strided_load_store_ops): Likewise. (vectorizable_store): Adjust. (vectorizable_load): Use the vector type from the SLP node and adjust.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/tree-vect-loop.cc14
-rw-r--r--gcc/tree-vect-slp.cc4
-rw-r--r--gcc/tree-vect-stmts.cc38
3 files changed, 28 insertions, 28 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index cd90df2..eb7c02d 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -2883,7 +2883,7 @@ again:
continue;
vinfo = DR_GROUP_FIRST_ELEMENT (vinfo);
unsigned int size = DR_GROUP_SIZE (vinfo);
- tree vectype = STMT_VINFO_VECTYPE (vinfo);
+ tree vectype = SLP_TREE_VECTYPE (SLP_INSTANCE_TREE (instance));
if (vect_store_lanes_supported (vectype, size, false) == IFN_LAST
&& ! known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U)
&& ! vect_grouped_store_supported (vectype, size))
@@ -2897,7 +2897,7 @@ again:
vinfo = DR_GROUP_FIRST_ELEMENT (vinfo);
bool single_element_p = !DR_GROUP_NEXT_ELEMENT (vinfo);
size = DR_GROUP_SIZE (vinfo);
- vectype = STMT_VINFO_VECTYPE (vinfo);
+ vectype = SLP_TREE_VECTYPE (node);
if (vect_load_lanes_supported (vectype, size, false) == IFN_LAST
&& ! vect_grouped_load_supported (vectype, single_element_p,
size))
@@ -6689,7 +6689,7 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo,
vec_loop_lens *lens)
{
class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- tree vectype_out = STMT_VINFO_VECTYPE (stmt_info);
+ tree vectype_out = SLP_TREE_VECTYPE (slp_node);
internal_fn mask_reduc_fn = get_masked_reduction_fn (reduc_fn, vectype_in);
gcc_assert (!nested_in_vect_loop_p (loop, stmt_info));
@@ -8181,7 +8181,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo,
stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
slp_tree slp_node)
{
- tree vectype_out = STMT_VINFO_VECTYPE (stmt_info);
+ tree vectype_out = SLP_TREE_VECTYPE (slp_node);
class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
unsigned vec_num;
@@ -8208,7 +8208,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo,
tree vectype_in = STMT_VINFO_REDUC_VECTYPE_IN (stmt_info);
if (!vectype_in)
- vectype_in = STMT_VINFO_VECTYPE (stmt_info);
+ vectype_in = SLP_TREE_VECTYPE (slp_node);
vec_num = vect_get_num_copies (loop_vinfo, slp_node, vectype_in);
@@ -8528,7 +8528,7 @@ vect_transform_cycle_phi (loop_vec_info loop_vinfo,
stmt_vec_info stmt_info,
slp_tree slp_node, slp_instance slp_node_instance)
{
- tree vectype_out = STMT_VINFO_VECTYPE (stmt_info);
+ tree vectype_out = SLP_TREE_VECTYPE (slp_node);
class loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
int i;
bool nested_cycle = false;
@@ -8781,7 +8781,7 @@ vect_transform_lc_phi (loop_vec_info loop_vinfo,
slp_tree slp_node)
{
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ tree vectype = SLP_TREE_VECTYPE (slp_node);
tree scalar_dest = gimple_phi_result (stmt_info->stmt);
basic_block bb = gimple_bb (stmt_info->stmt);
edge e = single_pred_edge (bb);
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 1c5acd9..c0636d8 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -5241,7 +5241,7 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size,
if (STMT_VINFO_STRIDED_P (stmt_vinfo)
|| compare_step_with_zero (vinfo, stmt_vinfo) <= 0
|| vect_load_lanes_supported
- (STMT_VINFO_VECTYPE (stmt_vinfo),
+ (SLP_TREE_VECTYPE (load_node),
DR_GROUP_SIZE (stmt_vinfo), masked) == IFN_LAST
/* ??? During SLP re-discovery with a single lane
a masked grouped load will appear permuted and
@@ -5262,7 +5262,7 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size,
|| SLP_TREE_LANES (load_node) == group_size
|| (vect_slp_prefer_store_lanes_p
(vinfo, stmt_vinfo,
- STMT_VINFO_VECTYPE (stmt_vinfo), masked,
+ SLP_TREE_VECTYPE (load_node), masked,
group_size, SLP_TREE_LANES (load_node))));
}
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 2d596b8..391e13a 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -1633,7 +1633,7 @@ prepare_vec_mask (loop_vec_info loop_vinfo, tree mask_type, tree loop_mask,
else values will be stored in the vector ELSVALS points to. */
static bool
-vect_truncate_gather_scatter_offset (stmt_vec_info stmt_info,
+vect_truncate_gather_scatter_offset (stmt_vec_info stmt_info, tree vectype,
loop_vec_info loop_vinfo, bool masked_p,
gather_scatter_info *gs_info,
vec<int> *elsvals)
@@ -1651,7 +1651,6 @@ vect_truncate_gather_scatter_offset (stmt_vec_info stmt_info,
}
/* Get the number of bits in an element. */
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
scalar_mode element_mode = SCALAR_TYPE_MODE (TREE_TYPE (vectype));
unsigned int element_bits = GET_MODE_BITSIZE (element_mode);
@@ -1731,14 +1730,14 @@ vect_truncate_gather_scatter_offset (stmt_vec_info stmt_info,
else values will be stored in the vector ELSVALS points to. */
static bool
-vect_use_strided_gather_scatters_p (stmt_vec_info stmt_info,
+vect_use_strided_gather_scatters_p (stmt_vec_info stmt_info, tree vectype,
loop_vec_info loop_vinfo, bool masked_p,
gather_scatter_info *gs_info,
vec<int> *elsvals)
{
if (!vect_check_gather_scatter (stmt_info, loop_vinfo, gs_info, elsvals)
|| gs_info->ifn == IFN_LAST)
- return vect_truncate_gather_scatter_offset (stmt_info, loop_vinfo,
+ return vect_truncate_gather_scatter_offset (stmt_info, vectype, loop_vinfo,
masked_p, gs_info, elsvals);
tree old_offset_type = TREE_TYPE (gs_info->offset);
@@ -2255,7 +2254,7 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
&& single_element_p
&& SLP_TREE_LANES (slp_node) == 1
&& loop_vinfo
- && vect_use_strided_gather_scatters_p (stmt_info, loop_vinfo,
+ && vect_use_strided_gather_scatters_p (stmt_info, vectype, loop_vinfo,
masked_p, gs_info, elsvals))
*memory_access_type = VMAT_GATHER_SCATTER;
else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
@@ -2607,8 +2606,7 @@ vect_check_scalar_mask (vec_info *vinfo, stmt_vec_info stmt_info,
/* If the caller is not prepared for adjusting an external/constant
SLP mask vector type fail. */
- if (slp_node
- && !mask_node
+ if (!mask_node
&& SLP_TREE_DEF_TYPE (mask_node_1) != vect_internal_def)
{
if (dump_enabled_p ())
@@ -2617,7 +2615,7 @@ vect_check_scalar_mask (vec_info *vinfo, stmt_vec_info stmt_info,
return false;
}
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ tree vectype = SLP_TREE_VECTYPE (slp_node);
if (!mask_vectype)
mask_vectype = get_mask_type_for_scalar_type (vinfo, TREE_TYPE (vectype),
mask_node_1);
@@ -2693,7 +2691,7 @@ vect_check_store_rhs (vec_info *vinfo, stmt_vec_info stmt_info,
return false;
}
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ tree vectype = SLP_TREE_VECTYPE (slp_node);
if (rhs_vectype && !useless_type_conversion_p (vectype, rhs_vectype))
{
if (dump_enabled_p ())
@@ -2799,11 +2797,11 @@ vect_get_mask_load_else (int elsval, tree type)
static gimple *
vect_build_one_gather_load_call (vec_info *vinfo, stmt_vec_info stmt_info,
+ tree vectype,
gimple_stmt_iterator *gsi,
gather_scatter_info *gs_info,
tree ptr, tree offset, tree mask)
{
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
tree arglist = TYPE_ARG_TYPES (TREE_TYPE (gs_info->decl));
tree rettype = TREE_TYPE (TREE_TYPE (gs_info->decl));
tree srctype = TREE_VALUE (arglist); arglist = TREE_CHAIN (arglist);
@@ -3006,7 +3004,7 @@ vect_get_gather_scatter_ops (class loop *loop,
I * DR_STEP / SCALE. */
static void
-vect_get_strided_load_store_ops (stmt_vec_info stmt_info,
+vect_get_strided_load_store_ops (stmt_vec_info stmt_info, tree vectype,
loop_vec_info loop_vinfo,
gimple_stmt_iterator *gsi,
gather_scatter_info *gs_info,
@@ -3014,7 +3012,6 @@ vect_get_strided_load_store_ops (stmt_vec_info stmt_info,
vec_loop_lens *loop_lens)
{
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
if (LOOP_VINFO_USING_SELECT_VL_P (loop_vinfo))
{
@@ -8383,7 +8380,8 @@ vectorizable_store (vec_info *vinfo,
{
aggr_type = elem_type;
if (!costing_p)
- vect_get_strided_load_store_ops (stmt_info, loop_vinfo, gsi, &gs_info,
+ vect_get_strided_load_store_ops (stmt_info, vectype, loop_vinfo,
+ gsi, &gs_info,
&bump, &vec_offset, loop_lens);
}
else
@@ -9404,7 +9402,7 @@ vectorizable_load (vec_info *vinfo,
return false;
}
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
+ tree vectype = SLP_TREE_VECTYPE (slp_node);
poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype);
if (loop_vinfo)
@@ -10262,7 +10260,8 @@ vectorizable_load (vec_info *vinfo,
{
aggr_type = elem_type;
if (!costing_p)
- vect_get_strided_load_store_ops (stmt_info, loop_vinfo, gsi, &gs_info,
+ vect_get_strided_load_store_ops (stmt_info, vectype, loop_vinfo,
+ gsi, &gs_info,
&bump, &vec_offset, loop_lens);
}
else
@@ -10581,7 +10580,7 @@ vectorizable_load (vec_info *vinfo,
if (known_eq (nunits, offset_nunits))
{
new_stmt = vect_build_one_gather_load_call
- (vinfo, stmt_info, gsi, &gs_info,
+ (vinfo, stmt_info, vectype, gsi, &gs_info,
dataref_ptr, vec_offsets[i], final_mask);
data_ref = NULL_TREE;
}
@@ -10591,7 +10590,7 @@ vectorizable_load (vec_info *vinfo,
lanes but the builtins will produce full vectype
data with just the lower lanes filled. */
new_stmt = vect_build_one_gather_load_call
- (vinfo, stmt_info, gsi, &gs_info,
+ (vinfo, stmt_info, vectype, gsi, &gs_info,
dataref_ptr, vec_offsets[2 * i], final_mask);
tree low = make_ssa_name (vectype);
gimple_set_lhs (new_stmt, low);
@@ -10630,7 +10629,8 @@ vectorizable_load (vec_info *vinfo,
}
new_stmt = vect_build_one_gather_load_call
- (vinfo, stmt_info, gsi, &gs_info, dataref_ptr,
+ (vinfo, stmt_info, vectype, gsi, &gs_info,
+ dataref_ptr,
vec_offsets[2 * i + 1], final_mask);
tree high = make_ssa_name (vectype);
gimple_set_lhs (new_stmt, high);
@@ -10673,7 +10673,7 @@ vectorizable_load (vec_info *vinfo,
new_stmt, gsi);
}
new_stmt = vect_build_one_gather_load_call
- (vinfo, stmt_info, gsi, &gs_info,
+ (vinfo, stmt_info, vectype, gsi, &gs_info,
dataref_ptr, vec_offset, final_mask);
data_ref = NULL_TREE;
}