public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org
Subject: PR lto/54728 (streamer ICE)
Date: Sat, 22 Dec 2012 23:37:00 -0000	[thread overview]
Message-ID: <20121222233707.GA9936@kam.mff.cuni.cz> (raw)

Hi,
in the testcase I don't really know how to put into testsuite since it needs DSO
there is issue with LTO not merging external declaration with body. This is because
logic in symtab_real_symbol_p that really applies only to LTO symbol table output
not to the symbol merging.

Bootstrapped/regtested x86_64-linux and tested with Mozilla build.

Honza

	PR lto/54728
	* cgraph.h (symtab_real_symbol_p): Drop code looking for external functions.
	* lto-streamer-out.c (output_symbol_p): New function.
	(produce_symtab) Use it.
Index: cgraph.h
===================================================================
*** cgraph.h	(revision 194605)
--- cgraph.h	(working copy)
*************** static inline bool
*** 1357,1363 ****
  symtab_real_symbol_p (symtab_node node)
  {
    struct cgraph_node *cnode;
-   struct ipa_ref *ref;
  
    if (!is_a <cgraph_node> (node))
      return true;
--- 1357,1362 ----
*************** symtab_real_symbol_p (symtab_node node)
*** 1366,1376 ****
      return false;
    if (cnode->abstract_and_needed)
      return false;
-   /* We keep virtual clones in symtab.  */
-   if (!cnode->analyzed
-       || DECL_EXTERNAL (cnode->symbol.decl))
-     return (cnode->callers
- 	    || ipa_ref_list_referring_iterate (&cnode->symbol.ref_list, 0, ref));
    return true;
  }
  #endif  /* GCC_CGRAPH_H  */
--- 1365,1370 ----
Index: lto-streamer-out.c
===================================================================
*** lto-streamer-out.c	(revision 194605)
--- lto-streamer-out.c	(working copy)
*************** write_symbol (struct streamer_tree_cache
*** 1257,1262 ****
--- 1257,1282 ----
    lto_output_data_stream (stream, &slot_num, 4);
  }
  
+ /* Return true if NODE should appear in the plugin symbol table.  */
+ 
+ bool
+ output_symbol_p (symtab_node node)
+ {
+   struct cgraph_node *cnode;
+   struct ipa_ref *ref;
+ 
+   if (!symtab_real_symbol_p (node))
+     return false;
+   /* We keep external functions in symtab for sake of inlining
+      and devirtualization.  We do not want to see them in symbol table as
+      references.  */
+   cnode = dyn_cast <cgraph_node> (node);
+   if (cnode && DECL_EXTERNAL (cnode->symbol.decl))
+     return (cnode->callers
+ 	    || ipa_ref_list_referring_iterate (&cnode->symbol.ref_list, 0, ref));
+   return true;
+ }
+ 
  
  /* Write an IL symbol table to OB.
     SET and VSET are cgraph/varpool node sets we are outputting.  */
*************** produce_symtab (struct output_block *ob)
*** 1285,1291 ****
      {
        symtab_node node = lsei_node (lsei);
  
!       if (!symtab_real_symbol_p (node) || DECL_EXTERNAL (node->symbol.decl))
  	continue;
        write_symbol (cache, &stream, node->symbol.decl, seen, false);
      }
--- 1305,1311 ----
      {
        symtab_node node = lsei_node (lsei);
  
!       if (!output_symbol_p (node) || DECL_EXTERNAL (node->symbol.decl))
  	continue;
        write_symbol (cache, &stream, node->symbol.decl, seen, false);
      }
*************** produce_symtab (struct output_block *ob)
*** 1294,1300 ****
      {
        symtab_node node = lsei_node (lsei);
  
!       if (!symtab_real_symbol_p (node) || !DECL_EXTERNAL (node->symbol.decl))
  	continue;
        write_symbol (cache, &stream, node->symbol.decl, seen, false);
      }
--- 1314,1320 ----
      {
        symtab_node node = lsei_node (lsei);
  
!       if (!output_symbol_p (node) || !DECL_EXTERNAL (node->symbol.decl))
  	continue;
        write_symbol (cache, &stream, node->symbol.decl, seen, false);
      }

                 reply	other threads:[~2012-12-22 23:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121222233707.GA9936@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).