public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3820] fix SLP subgraph detection wrt fully shared lanes
@ 2020-10-12 12:31 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2020-10-12 12:31 UTC (permalink / raw)
  To: gcc-cvs

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

commit r11-3820-ga7825bb6556da6fa991b7ea1b72e3851026dc2cd
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Oct 12 14:29:35 2020 +0200

    fix SLP subgraph detection wrt fully shared lanes
    
    When a VEC_PERM SLP node just permutes existing lanes this confuses
    the SLP subgraph detection where I tried to elide a node-based
    visited hash-map in a way that doesn't work.  Fixed by adding such.
    
    2020-10-12  Richard Biener  <rguenther@suse.de>
    
            * tree-vect-slp.c (vect_bb_partition_graph_r): Use visited
            hash-map.
            (vect_bb_partition_graph): Likewise.

Diff:
---
 gcc/tree-vect-slp.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index dd2042a4db5..8acef6f3cef 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -3254,18 +3254,19 @@ static void
 vect_bb_partition_graph_r (bb_vec_info bb_vinfo,
 			   slp_instance instance, slp_tree node,
 			   hash_map<stmt_vec_info, slp_instance> &stmt_to_instance,
-			   hash_map<slp_instance, slp_instance> &instance_leader)
+			   hash_map<slp_instance, slp_instance> &instance_leader,
+			   hash_set<slp_tree> &visited)
 {
   stmt_vec_info stmt_info;
   unsigned i;
-  bool all = true;
+
   FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
     {
       bool existed_p;
       slp_instance &stmt_instance
 	= stmt_to_instance.get_or_insert (stmt_info, &existed_p);
       if (!existed_p)
-	all = false;
+	;
       else if (stmt_instance != instance)
 	{
 	  /* If we're running into a previously marked stmt make us the
@@ -3279,15 +3280,15 @@ vect_bb_partition_graph_r (bb_vec_info bb_vinfo,
 	}
       stmt_instance = instance;
     }
-  /* If not all stmts had been visited we have to recurse on children.  */
-  if (all)
+
+  if (visited.add (node))
     return;
 
   slp_tree child;
   FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
     if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
       vect_bb_partition_graph_r (bb_vinfo, instance, child, stmt_to_instance,
-				 instance_leader);
+				 instance_leader, visited);
 }
 
 /* Partition the SLP graph into pieces that can be costed independently.  */
@@ -3302,13 +3303,15 @@ vect_bb_partition_graph (bb_vec_info bb_vinfo)
      marked stmt, make the stmts leader the current SLP graph entry.  */
   hash_map<stmt_vec_info, slp_instance> stmt_to_instance;
   hash_map<slp_instance, slp_instance> instance_leader;
+  hash_set<slp_tree> visited;
   slp_instance instance;
   for (unsigned i = 0; bb_vinfo->slp_instances.iterate (i, &instance); ++i)
     {
       instance_leader.put (instance, instance);
       vect_bb_partition_graph_r (bb_vinfo,
 				 instance, SLP_INSTANCE_TREE (instance),
-				 stmt_to_instance, instance_leader);
+				 stmt_to_instance, instance_leader,
+				 visited);
     }
 
   /* Then collect entries to each independent subgraph.  */


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

only message in thread, other threads:[~2020-10-12 12:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 12:31 [gcc r11-3820] fix SLP subgraph detection wrt fully shared lanes 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).