Commit 894dd753 by Richard Sandiford Committed by Richard Sandiford

[9a/n] PR85694: Reorder vect_is_simple_use arguments

As suggested by Richard B., this patch reorders the arguments to
vect_is_simple_use so that def_stmt comes last and is optional.
Many callers can then drop it, making it more obvious which of
the remaining calls would be affected by the next patch.

2018-06-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vectorizer.h (vect_is_simple_use): Move the gimple ** to the
	end and default to null.
	* tree-vect-loop.c (vect_create_epilog_for_reduction)
	(vectorizable_reduction): Update calls accordingly, dropping the
	gimple ** argument if the passed-back statement isn't needed.
	* tree-vect-patterns.c (vect_get_internal_def, type_conversion_p)
	(vect_recog_rotate_pattern): Likewise.
	(vect_recog_mask_conversion_pattern): Likewise.
	* tree-vect-slp.c (vect_get_and_check_slp_defs): Likewise.
	(vect_mask_constant_operand_p): Likewise.
	* tree-vect-stmts.c (is_simple_and_all_uses_invariant, process_use):
	(vect_model_simple_cost, vect_get_vec_def_for_operand): Likewise.
	(get_group_load_store_type, get_load_store_type): Likewise.
	(vect_check_load_store_mask, vect_check_store_rhs): Likewise.
	(vectorizable_call, vectorizable_simd_clone_call): Likewise.
	(vectorizable_conversion, vectorizable_assignment): Likewise.
	(vectorizable_shift, vectorizable_operation): Likewise.
	(vectorizable_store, vect_is_simple_cond): Likewise.
	(vectorizable_condition, vectorizable_comparison): Likewise.
	(get_same_sized_vectype, vect_get_mask_type_for_stmt): Likewise.
	(vect_is_simple_use): Rename the def_stmt argument to def_stmt_out
	and move it to the end.  Cope with null def_stmt_outs.

From-SVN: r262272
parent 55c8e04c
2018-06-30 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (vect_is_simple_use): Move the gimple ** to the
end and default to null.
* tree-vect-loop.c (vect_create_epilog_for_reduction)
(vectorizable_reduction): Update calls accordingly, dropping the
gimple ** argument if the passed-back statement isn't needed.
* tree-vect-patterns.c (vect_get_internal_def, type_conversion_p)
(vect_recog_rotate_pattern): Likewise.
(vect_recog_mask_conversion_pattern): Likewise.
* tree-vect-slp.c (vect_get_and_check_slp_defs): Likewise.
(vect_mask_constant_operand_p): Likewise.
* tree-vect-stmts.c (is_simple_and_all_uses_invariant, process_use):
(vect_model_simple_cost, vect_get_vec_def_for_operand): Likewise.
(get_group_load_store_type, get_load_store_type): Likewise.
(vect_check_load_store_mask, vect_check_store_rhs): Likewise.
(vectorizable_call, vectorizable_simd_clone_call): Likewise.
(vectorizable_conversion, vectorizable_assignment): Likewise.
(vectorizable_shift, vectorizable_operation): Likewise.
(vectorizable_store, vect_is_simple_cond): Likewise.
(vectorizable_condition, vectorizable_comparison): Likewise.
(get_same_sized_vectype, vect_get_mask_type_for_stmt): Likewise.
(vect_is_simple_use): Rename the def_stmt argument to def_stmt_out
and move it to the end. Cope with null def_stmt_outs.
2018-06-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
* Makefile.in (FLAGS_TO_PASS): Add RANLIB_FOR_TARGET.
......
......@@ -4572,7 +4572,6 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
{
/* Get at the scalar def before the loop, that defines the initial value
of the reduction variable. */
gimple *def_stmt;
initial_def = PHI_ARG_DEF_FROM_EDGE (reduc_def_stmt,
loop_preheader_edge (loop));
/* Optimize: if initial_def is for REDUC_MAX smaller than the base
......@@ -4587,7 +4586,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
|| (induc_code == MIN_EXPR
&& tree_int_cst_lt (induc_val, initial_def))))
induc_val = initial_def;
vect_is_simple_use (initial_def, loop_vinfo, &def_stmt, &initial_def_dt);
vect_is_simple_use (initial_def, loop_vinfo, &initial_def_dt);
vec_initial_def = get_initial_def_for_reduction (stmt, initial_def,
&adjustment_def);
vec_initial_defs.create (1);
......@@ -6396,7 +6395,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
continue;
is_simple_use = vect_is_simple_use (ops[i], loop_vinfo,
&def_stmt, &dts[i], &tem);
&dts[i], &tem, &def_stmt);
dt = dts[i];
gcc_assert (is_simple_use);
if (dt == vect_reduction_def)
......@@ -6592,8 +6591,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
= PHI_ARG_DEF_FROM_EDGE (def_stmt, loop_preheader_edge (loop));
gcc_assert (cond_reduc_val != NULL_TREE);
vect_is_simple_use (cond_initial_val, loop_vinfo,
&def_stmt, &cond_initial_dt);
vect_is_simple_use (cond_initial_val, loop_vinfo, &cond_initial_dt);
if (cond_initial_dt == vect_constant_def
&& types_compatible_p (TREE_TYPE (cond_initial_val),
TREE_TYPE (cond_reduc_val)))
......
......@@ -160,7 +160,7 @@ vect_get_internal_def (vec_info *vinfo, tree op)
vect_def_type dt;
gimple *def_stmt;
if (TREE_CODE (op) != SSA_NAME
|| !vect_is_simple_use (op, vinfo, &def_stmt, &dt)
|| !vect_is_simple_use (op, vinfo, &dt, &def_stmt)
|| dt != vect_internal_def)
return NULL;
......@@ -177,14 +177,13 @@ static bool
type_conversion_p (tree name, gimple *use_stmt, bool check_sign,
tree *orig_type, gimple **def_stmt, bool *promotion)
{
gimple *dummy_gimple;
stmt_vec_info stmt_vinfo;
tree type = TREE_TYPE (name);
tree oprnd0;
enum vect_def_type dt;
stmt_vinfo = vinfo_for_stmt (use_stmt);
if (!vect_is_simple_use (name, stmt_vinfo->vinfo, def_stmt, &dt))
if (!vect_is_simple_use (name, stmt_vinfo->vinfo, &dt, def_stmt))
return false;
if (dt != vect_internal_def
......@@ -219,7 +218,7 @@ type_conversion_p (tree name, gimple *use_stmt, bool check_sign,
else
*promotion = false;
if (!vect_is_simple_use (oprnd0, stmt_vinfo->vinfo, &dummy_gimple, &dt))
if (!vect_is_simple_use (oprnd0, stmt_vinfo->vinfo, &dt))
return false;
return true;
......@@ -1795,7 +1794,7 @@ vect_recog_rotate_pattern (vec<gimple *> *stmts, tree *type_out)
|| !TYPE_UNSIGNED (type))
return NULL;
if (!vect_is_simple_use (oprnd1, vinfo, &def_stmt, &dt))
if (!vect_is_simple_use (oprnd1, vinfo, &dt, &def_stmt))
return NULL;
if (dt != vect_internal_def
......@@ -3930,13 +3929,10 @@ vect_recog_mask_conversion_pattern (vec<gimple *> *stmts, tree *type_out)
&& known_le (TYPE_VECTOR_SUBPARTS (vectype1),
TYPE_VECTOR_SUBPARTS (vectype2)))
{
gimple *dummy;
enum vect_def_type dt;
if (vect_is_simple_use (TREE_OPERAND (rhs1, 0), stmt_vinfo->vinfo,
&dummy, &dt)
if (vect_is_simple_use (TREE_OPERAND (rhs1, 0), vinfo, &dt)
&& dt == vect_external_def
&& vect_is_simple_use (TREE_OPERAND (rhs1, 1), stmt_vinfo->vinfo,
&dummy, &dt)
&& vect_is_simple_use (TREE_OPERAND (rhs1, 1), vinfo, &dt)
&& (dt == vect_external_def
|| dt == vect_constant_def))
{
......
......@@ -348,7 +348,7 @@ again:
oprnd_info = (*oprnds_info)[i];
if (!vect_is_simple_use (oprnd, vinfo, &def_stmt, &dt))
if (!vect_is_simple_use (oprnd, vinfo, &dt, &def_stmt))
{
if (dump_enabled_p ())
{
......@@ -3105,7 +3105,6 @@ vect_mask_constant_operand_p (gimple *stmt, int opnum)
stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
enum tree_code code = gimple_expr_code (stmt);
tree op, vectype;
gimple *def_stmt;
enum vect_def_type dt;
/* For comparison and COND_EXPR type is chosen depending
......@@ -3117,8 +3116,7 @@ vect_mask_constant_operand_p (gimple *stmt, int opnum)
else
op = gimple_assign_rhs2 (stmt);
if (!vect_is_simple_use (op, stmt_vinfo->vinfo, &def_stmt,
&dt, &vectype))
if (!vect_is_simple_use (op, stmt_vinfo->vinfo, &dt, &vectype))
gcc_unreachable ();
return !vectype || VECTOR_BOOLEAN_TYPE_P (vectype);
......@@ -3135,8 +3133,7 @@ vect_mask_constant_operand_p (gimple *stmt, int opnum)
else
op = TREE_OPERAND (cond, 0);
if (!vect_is_simple_use (op, stmt_vinfo->vinfo, &def_stmt,
&dt, &vectype))
if (!vect_is_simple_use (op, stmt_vinfo->vinfo, &dt, &vectype))
gcc_unreachable ();
return !vectype || VECTOR_BOOLEAN_TYPE_P (vectype);
......
......@@ -1477,10 +1477,10 @@ extern tree get_vectype_for_scalar_type_and_size (tree, poly_uint64);
extern tree get_mask_type_for_scalar_type (tree);
extern tree get_same_sized_vectype (tree, tree);
extern bool vect_get_loop_mask_type (loop_vec_info);
extern bool vect_is_simple_use (tree, vec_info *, gimple **,
enum vect_def_type *);
extern bool vect_is_simple_use (tree, vec_info *, gimple **,
enum vect_def_type *, tree *);
extern bool vect_is_simple_use (tree, vec_info *, enum vect_def_type *,
gimple ** = NULL);
extern bool vect_is_simple_use (tree, vec_info *, enum vect_def_type *,
tree *, gimple ** = NULL);
extern bool supportable_widening_operation (enum tree_code, gimple *, tree,
tree, enum tree_code *,
enum tree_code *, int *,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment