Fix memory allocations in ipa-modref.
authorJan Hubicka <jh@suse.cz>
Thu, 24 Sep 2020 06:28:09 +0000 (08:28 +0200)
committerJan Hubicka <jh@suse.cz>
Thu, 24 Sep 2020 06:28:09 +0000 (08:28 +0200)
commitc9da53d6987af5f8ff68b58dd76a9fbc900a6a21
treee0bed9ee6fe0d60237cdb71cbae19944289b800a
parent2d5fb576bdda843da47aea2e025bb5d45e883827
Fix memory allocations in ipa-modref.

Pair ggc_delete with ggc_alloc_no_dtor.  I copy same scheme as used by Martin
in ipa-fnsummary, that is creating a static member function create_ggc hidding
the ugly bits and using it in ipa-modref.c.

I also noticed that modref-tree leaks memory on destruction/collapse method and
fixed that.

Bootstrapped/regtested x86_64-linux.

gcc/ChangeLog:

2020-09-24  Jan Hubicka  <hubicka@ucw.cz>

* ipa-modref-tree.h (modref_base::collapse): Release memory.
(modref_tree::create_ggc): New member function.
(modref_tree::colapse): Release memory.
(modref_tree::~modref_tree): New destructor.
* ipa-modref.c (modref_summaries::create_ggc): New function.
(analyze_function): Use create_ggc.
(modref_summaries::duplicate): Likewise.
(read_modref_records): Likewise.
(modref_read): Likewise.
gcc/ipa-modref-tree.h
gcc/ipa-modref.c