aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-11-03 16:58:43 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2019-11-03 15:58:43 +0000
commit360386c7ef1c3fa30de216b1d68ed6a27296fd80 (patch)
tree014d93005b447904b623d66fca1e1d6e0076356c /gcc
parent1532500ecbe8dbf59bef498e46b447b3a6b0fa65 (diff)
downloadgcc-360386c7ef1c3fa30de216b1d68ed6a27296fd80.zip
gcc-360386c7ef1c3fa30de216b1d68ed6a27296fd80.tar.gz
gcc-360386c7ef1c3fa30de216b1d68ed6a27296fd80.tar.bz2
ipa-fnsummary.c (inline_read_section): Set vector size ahead of time.
* ipa-fnsummary.c (inline_read_section): Set vector size ahead of time. From-SVN: r277756
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ipa-fnsummary.c15
2 files changed, 16 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 817a333..c249890 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2019-11-02 Jan Hubicka <hubicka@ucw.cz>
+ * ipa-fnsummary.c (inline_read_section): Set vector size
+ ahead of time.
+
+2019-11-02 Jan Hubicka <hubicka@ucw.cz>
+
* ipa-fnsummary.c (ipa_call_context): New constructor.
(estimate_node_size_and_time): Turn to ...
(ipa_call_context::estimate_size_and_time): ... this one.
diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 9dc8754..96b50cc 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -3638,6 +3638,8 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
count2 = streamer_read_uhwi (&ib);
gcc_assert (!info || !info->conds);
+ if (info)
+ vec_safe_reserve_exact (info->conds, count2);
for (j = 0; j < count2; j++)
{
struct condition c;
@@ -3651,8 +3653,10 @@ 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);
- c.param_ops = NULL;
count3 = streamer_read_uhwi (&ib);
+ c.param_ops = NULL;
+ if (info)
+ vec_safe_reserve_exact (c.param_ops, count3);
for (k = 0; k < count3; k++)
{
struct expr_eval_op op;
@@ -3682,13 +3686,16 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
fatal_error (UNKNOWN_LOCATION,
"invalid fnsummary in LTO stream");
}
- vec_safe_push (c.param_ops, op);
+ if (info)
+ c.param_ops->quick_push (op);
}
if (info)
- vec_safe_push (info->conds, c);
+ info->conds->quick_push (c);
}
count2 = streamer_read_uhwi (&ib);
gcc_assert (!info || !info->size_time_table);
+ if (info && count2)
+ vec_safe_reserve_exact (info->size_time_table, count2);
for (j = 0; j < count2; j++)
{
class size_time_entry e;
@@ -3699,7 +3706,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
e.nonconst_predicate.stream_in (&ib);
if (info)
- vec_safe_push (info->size_time_table, e);
+ info->size_time_table->quick_push (e);
}
p.stream_in (&ib);