random memory leak fixes

This fixes leaks discovered checking whether I introduced new ones
with the last vectorizer changes.

2020-10-09  Richard Biener  <rguenther@suse.de>

	* cgraphunit.c (expand_all_functions): Free tp_first_run_order.
	* ipa-modref.c (pass_ipa_modref::execute): Free order.
	* tree-ssa-loop-niter.c (estimate_numbers_of_iterations): Free
	loop body.
	* tree-vect-data-refs.c (vect_find_stmt_data_reference): Free
	data references upon failure.
	* tree-vect-loop.c (update_epilogue_loop_vinfo): Free BBs
	array of the original loop.
	* tree-vect-slp.c (vect_slp_bbs): Use an auto_vec for
	dataref_groups to release its memory.
This commit is contained in:
Richard Biener 2020-10-09 09:47:44 +02:00
parent 781634daea
commit a0e6e49dde
6 changed files with 30 additions and 13 deletions

View File

@ -2494,6 +2494,7 @@ expand_all_functions (void)
delete ipa_saved_clone_sources;
ipa_saved_clone_sources = NULL;
free (order);
free (tp_first_run_order);
}
/* This is used to sort the node types by the cgraph order number. */

View File

@ -1748,6 +1748,7 @@ pass_ipa_modref::execute (function *)
}
((modref_summaries *)summaries)->ipa = false;
ipa_free_postorder_info ();
free (order);
return 0;
}

View File

@ -4305,6 +4305,7 @@ estimate_numbers_of_iterations (class loop *loop)
if (flag_aggressive_loop_optimizations)
infer_loop_bounds_from_undefined (loop, body);
free (body);
discover_iteration_bound_by_body_walk (loop);

View File

@ -4045,29 +4045,42 @@ vect_find_stmt_data_reference (loop_p loop, gimple *stmt,
return opt_result::success ();
if (refs.length () > 1)
return opt_result::failure_at (stmt,
"not vectorized:"
" more than one data ref in stmt: %G", stmt);
{
while (!refs.is_empty ())
free_data_ref (refs.pop ());
return opt_result::failure_at (stmt,
"not vectorized: more than one "
"data ref in stmt: %G", stmt);
}
data_reference_p dr = refs.pop ();
if (gcall *call = dyn_cast <gcall *> (stmt))
if (!gimple_call_internal_p (call)
|| (gimple_call_internal_fn (call) != IFN_MASK_LOAD
&& gimple_call_internal_fn (call) != IFN_MASK_STORE))
return opt_result::failure_at (stmt,
"not vectorized: dr in a call %G", stmt);
{
free_data_ref (dr);
return opt_result::failure_at (stmt,
"not vectorized: dr in a call %G", stmt);
}
data_reference_p dr = refs.pop ();
if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF
&& DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1)))
return opt_result::failure_at (stmt,
"not vectorized:"
" statement is bitfield access %G", stmt);
{
free_data_ref (dr);
return opt_result::failure_at (stmt,
"not vectorized:"
" statement is bitfield access %G", stmt);
}
if (DR_BASE_ADDRESS (dr)
&& TREE_CODE (DR_BASE_ADDRESS (dr)) == INTEGER_CST)
return opt_result::failure_at (stmt,
"not vectorized:"
" base addr of dr is a constant\n");
{
free_data_ref (dr);
return opt_result::failure_at (stmt,
"not vectorized:"
" base addr of dr is a constant\n");
}
/* Check whether this may be a SIMD lane access and adjust the
DR to make it easier for us to handle it. */

View File

@ -8817,6 +8817,7 @@ update_epilogue_loop_vinfo (class loop *epilogue, tree advance)
basic_block *epilogue_bbs = get_loop_body (epilogue);
unsigned i;
free (LOOP_VINFO_BBS (epilogue_vinfo));
LOOP_VINFO_BBS (epilogue_vinfo) = epilogue_bbs;
/* Advance data_reference's with the number of iterations of the previous

View File

@ -3783,7 +3783,7 @@ static bool
vect_slp_bbs (vec<basic_block> bbs)
{
vec<data_reference_p> datarefs = vNULL;
vec<int> dataref_groups = vNULL;
auto_vec<int> dataref_groups;
int insns = 0;
int current_group = 0;