[PATCH 1/3] Release structures on function return
Jan Hubicka
hubicka@ucw.cz
Tue Jun 25 10:23:01 GMT 2024
> The value vec objects are destroyed on exit, but release still needs to
> be called explicitly.
>
> gcc/ChangeLog:
>
> * tree-profile.cc (find_conditions): Release vectors before
> return.
I wonder if you turn
hash_map<int_hash<unsigned, 0>, vec<basic_block>> exprs;
to
hash_map<int_hash<unsigned, 0>, auto_vec<basic_block>> exprs;
Won't hash_map destructor take care of this by itself?
Honza
> ---
> gcc/tree-profile.cc | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc
> index e4bb689cef5..18f48e8d04e 100644
> --- a/gcc/tree-profile.cc
> +++ b/gcc/tree-profile.cc
> @@ -919,6 +919,9 @@ find_conditions (struct function *fn)
> if (!have_post_dom)
> free_dominance_info (fn, CDI_POST_DOMINATORS);
>
> + for (auto expr : exprs)
> + expr.second.release ();
> +
> cov->m_masks.safe_grow_cleared (2 * cov->m_index.last ());
> const size_t length = cov_length (cov);
> for (size_t i = 0; i != length; i++)
> --
> 2.39.2
>
More information about the Gcc-patches
mailing list