[PATCH] Fix some memleaks
Richard Biener
rguenther@suse.de
Thu Oct 29 16:03:37 GMT 2020
This fixes some memleaks, one older, one recently introduced.
Bootstrap / regtest in progress on x86_64-unknown-linux-gnu.
2020-10-29 Richard Biener <rguenther@suse.de>
* tree-ssa-pre.c (compute_avail): Free operands consistently.
* tree-vect-loop.c (vectorizable_phi): Make sure all operand
defs vectors are released.
---
gcc/tree-ssa-pre.c | 5 ++++-
gcc/tree-vect-loop.c | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 63f3a81e94c..bcef9720095 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3953,7 +3953,10 @@ compute_avail (void)
adding the reference to EXP_GEN. */
if (BB_MAY_NOTRETURN (block)
&& vn_reference_may_trap (ref))
- continue;
+ {
+ operands.release ();
+ continue;
+ }
/* If the value of the reference is not invalidated in
this block until it is computed, add the expression
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 75b731407ba..5ab125d15c6 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -7570,7 +7570,6 @@ vectorizable_phi (vec_info *,
tree scalar_dest = gimple_phi_result (stmt_info->stmt);
basic_block bb = gimple_bb (stmt_info->stmt);
tree vec_dest = vect_create_destination_var (scalar_dest, vectype);
- auto_vec<tree> vec_oprnds;
auto_vec<gphi *> new_phis;
for (unsigned i = 0; i < gimple_phi_num_args (stmt_info->stmt); ++i)
{
@@ -7581,6 +7580,7 @@ vectorizable_phi (vec_info *,
&& SLP_TREE_VEC_STMTS (child).is_empty ())
continue;
+ auto_vec<tree> vec_oprnds;
vect_get_slp_defs (SLP_TREE_CHILDREN (slp_node)[i], &vec_oprnds);
if (!new_phis.exists ())
{
--
2.26.2
More information about the Gcc-patches
mailing list