lto.c (compare_tree_sccs_1): Compare DECL_ABSTRACT_ORIGIN.
authorRichard Biener <rguenther@suse.de>
Mon, 31 Aug 2015 14:01:45 +0000 (14:01 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 31 Aug 2015 14:01:45 +0000 (14:01 +0000)
2015-08-31  Richard Biener  <rguenther@suse.de>

lto/
* lto.c (compare_tree_sccs_1): Compare DECL_ABSTRACT_ORIGIN.
* lto-symtab.c (lto_symtab_merge): Merge DECL_POSSIBLY_INLINED flag.
(lto_symtab_prevailing_decl): Do not replace a decl that didn't
participate in merging with something else.

From-SVN: r227345

gcc/lto/ChangeLog
gcc/lto/lto-symtab.c
gcc/lto/lto.c

index 56dcfa8f3c096a9bfcacb93ab55b7ee9f591c4d0..8d3c83f2226f8bf26f4b4c2e10dc663c279ed4cc 100644 (file)
@@ -1,3 +1,10 @@
+2015-08-31  Richard Biener  <rguenther@suse.de>
+
+       * lto.c (compare_tree_sccs_1): Compare DECL_ABSTRACT_ORIGIN.
+       * lto-symtab.c (lto_symtab_merge): Merge DECL_POSSIBLY_INLINED flag.
+       (lto_symtab_prevailing_decl): Do not replace a decl that didn't
+       participate in merging with something else.
+
 2015-08-31  Richard Biener  <rguenther@suse.de>
 
        * lto-symtab.c (lto_symtab_prevailing_decl): Remove redundant
index d50a1abd3a0529859208f4df4299006b1e11e839..c77ae947c32617c268c5a961649b5bc651c10cfd 100644 (file)
@@ -312,6 +312,11 @@ lto_symtab_merge (symtab_node *prevailing, symtab_node *entry)
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     {
+      /* Merge decl state in both directions, we may still end up using
+        the new decl.  */
+      DECL_POSSIBLY_INLINED (prevailing_decl) |= DECL_POSSIBLY_INLINED (decl);
+      DECL_POSSIBLY_INLINED (decl) |= DECL_POSSIBLY_INLINED (prevailing_decl);
+
       if (warn_type_compatibility_p (TREE_TYPE (prevailing_decl),
                                     TREE_TYPE (decl)))
        return false;
@@ -798,6 +803,18 @@ lto_symtab_prevailing_decl (tree decl)
   if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT_P (decl))
     return decl;
 
+  /* When decl did not participate in symbol resolution leave it alone.
+     This can happen when we streamed the decl as abstract origin
+     from the block tree of inlining a partially inlined function.
+     If all, the split function and the original function end up
+     optimized away early we do not put the abstract origin into the
+     ltrans boundary and we'll end up ICEing in
+     dwarf2out.c:gen_inlined_subroutine_die because we eventually
+     replace a decl with DECL_POSSIBLY_INLINED set with one without.  */
+  if (TREE_CODE (decl) == FUNCTION_DECL
+      && ! cgraph_node::get (decl))
+    return decl;
+
   /* Ensure DECL_ASSEMBLER_NAME will not set assembler name.  */
   gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl));
 
index b4287a358f82754b674d910af1b05ccadefb480d..4bb0aafcb7db1150846b01836d5e678a32ab3be6 100644 (file)
@@ -1305,6 +1305,7 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
       compare_tree_edges (DECL_SIZE (t1), DECL_SIZE (t2));
       compare_tree_edges (DECL_SIZE_UNIT (t1), DECL_SIZE_UNIT (t2));
       compare_tree_edges (DECL_ATTRIBUTES (t1), DECL_ATTRIBUTES (t2));
+      compare_tree_edges (DECL_ABSTRACT_ORIGIN (t1), DECL_ABSTRACT_ORIGIN (t2));
       if ((code == VAR_DECL
           || code == PARM_DECL)
          && DECL_HAS_VALUE_EXPR_P (t1))