re PR ipa/92357 (ICE in IPA pass fnsummary in openmp offload)
authorJakub Jelinek <jakub@redhat.com>
Sat, 14 Dec 2019 11:19:07 +0000 (12:19 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 14 Dec 2019 11:19:07 +0000 (12:19 +0100)
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
gcc/ipa-fnsummary.c

index e0ac204d0e3559d0e9d24a683bc6b6a2d94a615e..a8d4a8192bd0d75573bd607d74daca283b780e38 100644 (file)
@@ -1,5 +1,11 @@
 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.
index a46b1445765f7001d43e831ef7c8c692810756fe..a54703fb34775a8e1b8dce30f801fd790dd94ce2 100644 (file)
@@ -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 <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);