From d876184c095d6ac41e64eaf4e2c78864d2d935c1 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 15 Sep 2020 16:12:53 +0200 Subject: [PATCH] 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 * 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. --- gcc/tree-vect-slp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index d844fe4d6bb..f9f4d706f0a 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -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 stmts, unsigned stmt_num, vec *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 children; -- 2.30.2