public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3209] make swap argument of vect_get_and_check_slp_defs readonly
@ 2020-09-15 14:59 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2020-09-15 14:59 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d876184c095d6ac41e64eaf4e2c78864d2d935c1

commit r11-3209-gd876184c095d6ac41e64eaf4e2c78864d2d935c1
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Sep 15 16:12:53 2020 +0200

    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.

Diff:
---
 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<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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-15 14:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 14:59 [gcc r11-3209] make swap argument of vect_get_and_check_slp_defs readonly Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).