The following avoids copying scalar stmts again for the re-lookup
of the slot to replace the NULL guard with node.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

        * tree-vect-slp.cc (vect_cse_slp_nodes): Fix memory leak.
---
 gcc/tree-vect-slp.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 849863c1505..44ce9dbbab2 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -7024,7 +7024,7 @@ vect_cse_slp_nodes (scalar_stmts_to_slp_tree_map_t 
*bst_map, slp_tree& node)
 
   /* Now record the node for CSE in other siblings.  */
   if (put_p)
-    bst_map->put (SLP_TREE_SCALAR_STMTS (node).copy (), node);
+    *bst_map->get (SLP_TREE_SCALAR_STMTS (node)) = node;
 }
 
 /* Optimize the SLP graph of VINFO.  */
-- 
2.43.0

Reply via email to