Fix some memleaks
authorRichard Biener <rguenther@suse.de>
Thu, 29 Oct 2020 16:02:13 +0000 (17:02 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 29 Oct 2020 17:38:43 +0000 (18:38 +0100)
This fixes some memleaks, one older, one recently introduced.

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
gcc/tree-vect-loop.c

index 63f3a81e94c2056f8a548e580e8f99c5bb12511b..bcef9720095473a0236de95a03716d8bc7ae78a3 100644 (file)
@@ -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
index 75b731407ba45f3dce8994c5655b18a1990c7883..5ab125d15c6db9b360833a79a51eca0e1c00195f 100644 (file)
@@ -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 ())
        {