From: Richard Biener Date: Fri, 8 Jan 2021 13:22:00 +0000 (+0100) Subject: fix vectorizer memleaks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b407f233d7c18534fbfe8f74af7f0232498fb0c4;p=gcc.git fix vectorizer memleaks This plugs two memleaks in the vectorizer. 2021-01-08 Richard Biener * tree-vect-slp.c (scalar_stmts_to_slp_tree_map_t): Fix. (vect_build_slp_tree): On cache hit release the matched scalar stmts vector. * tree-vect-stmts.c (vectorizable_store): Properly free vec_oprnds before possibly gathering them again. --- diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index e0f3539aa54..e7191ed3267 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1378,7 +1378,7 @@ bst_traits::equal (value_type existing, value_type candidate) return true; } -typedef hash_map , slp_tree, +typedef hash_map , slp_tree, simple_hashmap_traits > scalar_stmts_to_slp_tree_map_t; @@ -1405,6 +1405,7 @@ vect_build_slp_tree (vec_info *vinfo, { SLP_TREE_REF_COUNT (*leader)++; vect_update_max_nunits (max_nunits, (*leader)->max_nunits); + stmts.release (); } return *leader; } diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 014f1aff4c1..068e4982303 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -7717,11 +7717,11 @@ vectorizable_store (vec_info *vinfo, } } next_stmt_info = DR_GROUP_NEXT_ELEMENT (next_stmt_info); + vec_oprnds.release (); if (slp) break; } - vec_oprnds.release (); return true; }