diff mbox series

Fix memory leak in vect_cse_slp_nodes

Message ID 20241008132848.2ECA73861837@sourceware.org
State New
Headers show
Series Fix memory leak in vect_cse_slp_nodes | expand

Commit Message

Richard Biener Oct. 8, 2024, 1:28 p.m. UTC
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 mbox series

Patch

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.  */