make swap argument of vect_get_and_check_slp_defs readonly

Since some time we're only using this argument to communicate from
vect_build_slp_tree_1 to vect_get_and_check_slp_defs.  This makes
the direction of information flow clear.

2020-09-15  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_get_and_check_slp_defs): Make swap
	argument by-value and do not change it.
	(vect_build_slp_tree_2): Adjust, set swap to NULL after last
	use.
This commit is contained in:
Richard Biener 2020-09-15 16:12:53 +02:00
parent 3304888c25
commit d876184c09

View file

@ -391,7 +391,7 @@ can_duplicate_and_interleave_p (vec_info *vinfo, unsigned int count,
swapping operands of father node of this one, return 1; if everything is
ok return 0. */
static int
vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char *swap,
vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
vec<stmt_vec_info> stmts, unsigned stmt_num,
vec<slp_oprnd_info> *oprnds_info)
{
@ -441,7 +441,7 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char *swap,
else
return -1;
bool swapped = (*swap != 0);
bool swapped = (swap != 0);
gcc_assert (!swapped || first_op_cond);
for (i = 0; i < number_of_oprnds; i++)
{
@ -450,7 +450,7 @@ again:
{
/* Map indicating how operands of cond_expr should be swapped. */
int maps[3][4] = {{0, 1, 2, 3}, {1, 0, 2, 3}, {0, 1, 3, 2}};
int *map = maps[*swap];
int *map = maps[swap];
if (i < 2)
oprnd = TREE_OPERAND (gimple_op (stmt_info->stmt,
@ -607,7 +607,6 @@ again:
stmt_info->stmt);
}
*swap = swapped;
return 0;
}
@ -1391,7 +1390,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
slp_oprnd_info oprnd_info;
FOR_EACH_VEC_ELT (stmts, i, stmt_info)
{
int res = vect_get_and_check_slp_defs (vinfo, &swap[i],
int res = vect_get_and_check_slp_defs (vinfo, swap[i],
stmts, i, &oprnds_info);
if (res != 0)
matches[(res == -1) ? 0 : i] = false;
@ -1404,6 +1403,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
vect_free_oprnd_info (oprnds_info);
return NULL;
}
swap = NULL;
auto_vec<slp_tree, 4> children;