From: Richard Biener Date: Tue, 8 Oct 2024 12:24:27 +0000 (+0200) Subject: Fix memory leak in vect_cse_slp_nodes X-Git-Tag: basepoints/gcc-16~5360 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fd883919b2644c16a6bb00ba39bcba98cc26979d;p=thirdparty%2Fgcc.git Fix memory leak in vect_cse_slp_nodes 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. --- 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. */