From 16570c12c91dc25beac2f96cf8b9d9b5ccd3cef3 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 14 Dec 2019 12:19:07 +0100 Subject: [PATCH] re PR ipa/92357 (ICE in IPA pass fnsummary in openmp offload) PR ipa/92357 * ipa-fnsummary.c (ipa_fn_summary_write): Use lto_symtab_encoder_iterator with lsei_start_function_in_partition and lsei_next_function_in_partition instead of walking all cgraph nodes in encoder. From-SVN: r279395 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-fnsummary.c | 18 +++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e0ac204d0e3..a8d4a8192bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2019-12-14 Jakub Jelinek + PR ipa/92357 + * ipa-fnsummary.c (ipa_fn_summary_write): Use + lto_symtab_encoder_iterator with lsei_start_function_in_partition and + lsei_next_function_in_partition instead of walking all cgraph nodes + in encoder. + PR tree-optimization/92930 * ipa-pure-const.c (special_builtin_state): Don't handle BUILT_IN_APPLY. Formatting fixes. diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c index a46b1445765..a54703fb347 100644 --- a/gcc/ipa-fnsummary.c +++ b/gcc/ipa-fnsummary.c @@ -4364,24 +4364,24 @@ static void ipa_fn_summary_write (void) { struct output_block *ob = create_output_block (LTO_section_ipa_fn_summary); + lto_symtab_encoder_iterator lsei; lto_symtab_encoder_t encoder = ob->decl_state->symtab_node_encoder; unsigned int count = 0; - int i; - for (i = 0; i < lto_symtab_encoder_size (encoder); i++) + for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei); + lsei_next_function_in_partition (&lsei)) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); - if (cnode && cnode->definition && !cnode->alias) + cgraph_node *cnode = lsei_cgraph_node (lsei); + if (cnode->definition && !cnode->alias) count++; } streamer_write_uhwi (ob, count); - for (i = 0; i < lto_symtab_encoder_size (encoder); i++) + for (lsei = lsei_start_function_in_partition (encoder); !lsei_end_p (lsei); + lsei_next_function_in_partition (&lsei)) { - symtab_node *snode = lto_symtab_encoder_deref (encoder, i); - cgraph_node *cnode = dyn_cast (snode); - if (cnode && cnode->definition && !cnode->alias) + cgraph_node *cnode = lsei_cgraph_node (lsei); + if (cnode->definition && !cnode->alias) { class ipa_fn_summary *info = ipa_fn_summaries->get (cnode); class ipa_size_summary *size_info = ipa_size_summaries->get (cnode); -- 2.30.2