2019-12-14 Jakub Jelinek <jakub@redhat.com>
+ 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.
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 <cgraph_node *> (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 <cgraph_node *> (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);