]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix memory leak in vect_cse_slp_nodes
authorRichard Biener <rguenther@suse.de>
Tue, 8 Oct 2024 12:24:27 +0000 (14:24 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 9 Oct 2024 07:43:29 +0000 (09:43 +0200)
The following avoids copying scalar stmts again for the re-lookup
of the slot to replace the NULL guard with node.

* tree-vect-slp.cc (vect_cse_slp_nodes): Fix memory leak.

gcc/tree-vect-slp.cc

index 849863c15057cf00e64b88719f583f26810101f5..44ce9dbbab2d087173540c8ed04f404843b6bbe3 100644 (file)
@@ -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.  */