On Wed, Nov 19, 2014 at 11:46 AM, David Malcolm <dmalc...@redhat.com> wrote:
> this_target_ira_int->free_ira_costs () is called by ira_init_costs,
> but this isn't called after the compile, causing noise when running
> under valgrind.
>
> This patch adds a ira_costs_c_finalize function to clean this up,
> and calls it from toplev::finalize (and hence this isn't called by
> cc1/cc1plus/etc, just by libgccjit.so).
>
> Doing so eliminates about 27KB of "leak" from the valgrind report.

Ok.

Thanks,
Richard.

> gcc/ChangeLog:
>         PR jit/63854
>         * ira-costs.c (ira_costs_c_finalize): New function.
>         * ira.h (ira_costs_c_finalize): New prototype.
>         * toplev.c (toplev::finalize): Call ira_costs_c_finalize.
> ---
>  gcc/ira-costs.c | 6 ++++++
>  gcc/ira.h       | 3 +++
>  gcc/toplev.c    | 1 +
>  3 files changed, 10 insertions(+)
>
> diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
> index 122815b..2dabead 100644
> --- a/gcc/ira-costs.c
> +++ b/gcc/ira-costs.c
> @@ -2356,3 +2356,9 @@ ira_adjust_equiv_reg_cost (unsigned regno, int cost)
>    else
>      regno_equiv_gains[regno] += cost;
>  }
> +
> +void
> +ira_costs_c_finalize (void)
> +{
> +  this_target_ira_int->free_ira_costs ();
> +}
> diff --git a/gcc/ira.h b/gcc/ira.h
> index b294ea1..d62656c 100644
> --- a/gcc/ira.h
> +++ b/gcc/ira.h
> @@ -199,4 +199,7 @@ extern bool ira_bad_reload_regno (int, rtx, rtx);
>
>  extern void ira_adjust_equiv_reg_cost (unsigned, int);
>
> +/* ira-costs.c */
> +extern void ira_costs_c_finalize (void);
> +
>  #endif /* GCC_IRA_H */
> diff --git a/gcc/toplev.c b/gcc/toplev.c
> index 0d617c2..0181a3f 100644
> --- a/gcc/toplev.c
> +++ b/gcc/toplev.c
> @@ -2168,6 +2168,7 @@ toplev::finalize (void)
>    gcse_c_finalize ();
>    ipa_cp_c_finalize ();
>    ipa_reference_c_finalize ();
> +  ira_costs_c_finalize ();
>    params_c_finalize ();
>
>    finalize_options_struct (&global_options);
> --
> 1.8.5.3
>

Reply via email to