aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2018-12-16 13:05:04 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2018-12-16 12:05:04 +0000
commitddfb13175ffac5365234eb16f9022354ab9f4ab4 (patch)
tree36416e9d74f31f38a52be034c239b0d0e188f743
parent19adb97a310cd398814c5ccb75580b1658433cfc (diff)
downloadgcc-ddfb13175ffac5365234eb16f9022354ab9f4ab4.zip
gcc-ddfb13175ffac5365234eb16f9022354ab9f4ab4.tar.gz
gcc-ddfb13175ffac5365234eb16f9022354ab9f4ab4.tar.bz2
ipa-fnsummary.c (analyze_function_body): Do not loeak conds and size_time_table.
* ipa-fnsummary.c (analyze_function_body): Do not loeak conds and size_time_table. (ipa_fn_summary_generate): Add prevails parameter; do not allocate data when symbol is not prevailing. (inline_read_section): Likewise. From-SVN: r267185
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/ipa-fnsummary.c88
2 files changed, 72 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f95477f..eda1061 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2018-12-15 Jan Hubicka <hubicka@ucw.cz>
+ * ipa-fnsummary.c (analyze_function_body): Do not loeak conds and
+ size_time_table.
+ (ipa_fn_summary_generate): Add prevails parameter; do not allocate
+ data when symbol is not prevailing.
+ (inline_read_section): Likewise.
+
+2018-12-15 Jan Hubicka <hubicka@ucw.cz>
+
* cgraph.h (cgraph_node): Add predicate prevailing_p.
(cgraph_edge): Add predicate possible_call_in_translation_unit_p.
* ipa-prop.c (ipa_write_jump_function): Optimize streaming of ADDR_EXPR.
diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 23b7821..2f03890 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -1990,7 +1990,9 @@ analyze_function_body (struct cgraph_node *node, bool early)
gcc_assert (cfun == my_function);
memset(&fbi, 0, sizeof(fbi));
+ vec_free (info->conds);
info->conds = NULL;
+ vec_free (info->size_time_table);
info->size_time_table = NULL;
/* When optimizing and analyzing for IPA inliner, initialize loop optimizer
@@ -3193,28 +3195,46 @@ ipa_fn_summary_generate (void)
/* Write inline summary for edge E to OB. */
static void
-read_ipa_call_summary (struct lto_input_block *ib, struct cgraph_edge *e)
+read_ipa_call_summary (struct lto_input_block *ib, struct cgraph_edge *e,
+ bool prevails)
{
- struct ipa_call_summary *es = ipa_call_summaries->get_create (e);
+ struct ipa_call_summary *es = prevails
+ ? ipa_call_summaries->get_create (e) : NULL;
predicate p;
int length, i;
- es->call_stmt_size = streamer_read_uhwi (ib);
- es->call_stmt_time = streamer_read_uhwi (ib);
- es->loop_depth = streamer_read_uhwi (ib);
+ int size = streamer_read_uhwi (ib);
+ int time = streamer_read_uhwi (ib);
+ int depth = streamer_read_uhwi (ib);
+
+ if (es)
+ {
+ es->call_stmt_size = size;
+ es->call_stmt_time = time;
+ es->loop_depth = depth;
+ }
bitpack_d bp = streamer_read_bitpack (ib);
- es->is_return_callee_uncaptured = bp_unpack_value (&bp, 1);
+ if (es)
+ es->is_return_callee_uncaptured = bp_unpack_value (&bp, 1);
+ else
+ bp_unpack_value (&bp, 1);
p.stream_in (ib);
- edge_set_predicate (e, &p);
+ if (es)
+ edge_set_predicate (e, &p);
length = streamer_read_uhwi (ib);
- if (length)
+ if (length && es && e->possibly_call_in_translation_unit_p ())
{
es->param.safe_grow_cleared (length);
for (i = 0; i < length; i++)
es->param[i].change_prob = streamer_read_uhwi (ib);
}
+ else
+ {
+ for (i = 0; i < length; i++)
+ streamer_read_uhwi (ib);
+ }
}
@@ -3254,19 +3274,34 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
encoder = file_data->symtab_node_encoder;
node = dyn_cast<cgraph_node *> (lto_symtab_encoder_deref (encoder,
index));
- info = ipa_fn_summaries->get_create (node);
+ info = node->prevailing_p () ? ipa_fn_summaries->get_create (node) : NULL;
- info->estimated_stack_size
- = info->estimated_self_stack_size = streamer_read_uhwi (&ib);
- info->size = info->self_size = streamer_read_uhwi (&ib);
- info->time = sreal::stream_in (&ib);
+ int stack_size = streamer_read_uhwi (&ib);
+ int size = streamer_read_uhwi (&ib);
+ sreal time = sreal::stream_in (&ib);
+
+ if (info)
+ {
+ info->estimated_stack_size
+ = info->estimated_self_stack_size = stack_size;
+ info->size = info->self_size = size;
+ info->time = time;
+ }
bp = streamer_read_bitpack (&ib);
- info->inlinable = bp_unpack_value (&bp, 1);
- info->fp_expressions = bp_unpack_value (&bp, 1);
+ if (info)
+ {
+ info->inlinable = bp_unpack_value (&bp, 1);
+ info->fp_expressions = bp_unpack_value (&bp, 1);
+ }
+ else
+ {
+ bp_unpack_value (&bp, 1);
+ bp_unpack_value (&bp, 1);
+ }
count2 = streamer_read_uhwi (&ib);
- gcc_assert (!info->conds);
+ gcc_assert (!info || !info->conds);
for (j = 0; j < count2; j++)
{
struct condition c;
@@ -3279,10 +3314,11 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
c.by_ref = bp_unpack_value (&bp, 1);
if (c.agg_contents)
c.offset = streamer_read_uhwi (&ib);
- vec_safe_push (info->conds, c);
+ if (info)
+ vec_safe_push (info->conds, c);
}
count2 = streamer_read_uhwi (&ib);
- gcc_assert (!info->size_time_table);
+ gcc_assert (!info || !info->size_time_table);
for (j = 0; j < count2; j++)
{
struct size_time_entry e;
@@ -3292,19 +3328,23 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
e.exec_predicate.stream_in (&ib);
e.nonconst_predicate.stream_in (&ib);
- vec_safe_push (info->size_time_table, e);
+ if (info)
+ vec_safe_push (info->size_time_table, e);
}
p.stream_in (&ib);
- set_hint_predicate (&info->loop_iterations, p);
+ if (info)
+ set_hint_predicate (&info->loop_iterations, p);
p.stream_in (&ib);
- set_hint_predicate (&info->loop_stride, p);
+ if (info)
+ set_hint_predicate (&info->loop_stride, p);
p.stream_in (&ib);
- set_hint_predicate (&info->array_index, p);
+ if (info)
+ set_hint_predicate (&info->array_index, p);
for (e = node->callees; e; e = e->next_callee)
- read_ipa_call_summary (&ib, e);
+ read_ipa_call_summary (&ib, e, info != NULL);
for (e = node->indirect_calls; e; e = e->next_callee)
- read_ipa_call_summary (&ib, e);
+ read_ipa_call_summary (&ib, e, info != NULL);
}
lto_free_section_data (file_data, LTO_section_ipa_fn_summary, NULL, data,