aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2020-11-23 16:58:23 +0100
committerJan Hubicka <jh@suse.cz>2020-11-23 16:58:23 +0100
commit7ee0681e055aac83bdf7ef9c9556743c8461bc5e (patch)
tree5b425dc2d93dd95b27fac2796216d7ec58df112f /gcc
parent54af3008b6f05985d378a48d337d9c70c708ecff (diff)
downloadgcc-7ee0681e055aac83bdf7ef9c9556743c8461bc5e.zip
gcc-7ee0681e055aac83bdf7ef9c9556743c8461bc5e.tar.gz
gcc-7ee0681e055aac83bdf7ef9c9556743c8461bc5e.tar.bz2
Release ipa-prop's agg.items and make alocation more careful
This saves about 316MB WPAing Firefox * ipa-prop.c (build_agg_jump_func_from_list, ipa_read_jump_function): Reserve agg.items precisely. * ipa-prop.h (ipa_node_params::~ipa_node_params): Release descriptors (ipa_edge_args::~ipa_edge_args): Release agg.items.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ipa-prop.c7
-rw-r--r--gcc/ipa-prop.h5
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 7a5fa59..904a8f7 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1682,7 +1682,7 @@ build_agg_jump_func_from_list (struct ipa_known_agg_contents_list *list,
int value_count, HOST_WIDE_INT arg_offset,
struct ipa_jump_func *jfunc)
{
- vec_alloc (jfunc->agg.items, value_count);
+ vec_safe_reserve (jfunc->agg.items, value_count, true);
for (; list; list = list->next)
{
struct ipa_agg_jf_item item;
@@ -4745,7 +4745,10 @@ ipa_read_jump_function (class lto_input_block *ib,
count = streamer_read_uhwi (ib);
if (prevails)
- vec_alloc (jump_func->agg.items, count);
+ {
+ jump_func->agg.items = NULL;
+ vec_safe_reserve (jump_func->agg.items, count, true);
+ }
if (count)
{
struct bitpack_d bp = streamer_read_bitpack (ib);
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 77e92b0..56e8055 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -620,6 +620,7 @@ inline
ipa_node_params::~ipa_node_params ()
{
free (lattices);
+ vec_free (descriptors);
known_csts.release ();
known_contexts.release ();
}
@@ -895,6 +896,10 @@ class GTY((for_user)) ipa_edge_args
/* Destructor. */
~ipa_edge_args ()
{
+ unsigned int i;
+ ipa_jump_func *jf;
+ FOR_EACH_VEC_SAFE_ELT (jump_functions, i, jf)
+ vec_free (jf->agg.items);
vec_free (jump_functions);
vec_free (polymorphic_call_contexts);
}