+2015-06-11 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline, guarded with in_lto_p
+ 2015-06-02 Richard Biener <rguenther@suse.de>
+
+ PR debug/65549
+ * dwarf2out.c (lookup_context_die): New function.
+ (resolve_addr): Avoid forcing a full DIE for the
+ target of a DW_TAG_GNU_call_site during late compilation.
+ Instead create a stub DIE without a type if we have a
+ context DIE present.
+
+ Backport from mainline
+ 2014-04-04 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/59626
+ * ipa.c (process_references, symtab_remove_unreachable_nodes):
+ Drop bodies of always inline after early inlining.
+ (symtab_remove_unreachable_nodes): Remove always_inline attribute.
+
2015-06-10 Michael Meissner <meissner@linux.vnet.ibm.com>
Backport from mainline:
!= TYPE_NAME (TREE_TYPE (decl))));
}
+/* Looks up the DIE for a context. */
+
+static inline dw_die_ref
+lookup_context_die (tree context)
+{
+ if (context)
+ {
+ /* Find die that represents this context. */
+ if (TYPE_P (context))
+ {
+ context = TYPE_MAIN_VARIANT (context);
+ dw_die_ref ctx = lookup_type_die (context);
+ if (!ctx)
+ return NULL;
+ return strip_naming_typedef (context, ctx);
+ }
+ else
+ return lookup_decl_die (context);
+ }
+ return comp_unit_die ();
+}
+
/* Returns the DIE for a context. */
static inline dw_die_ref
&& DECL_EXTERNAL (tdecl)
&& DECL_ABSTRACT_ORIGIN (tdecl) == NULL_TREE)
{
- force_decl_die (tdecl);
- tdie = lookup_decl_die (tdecl);
+ dw_die_ref cdie;
+ if (!in_lto_p)
+ {
+ force_decl_die (tdecl);
+ tdie = lookup_decl_die (tdecl);
+ }
+ else if ((cdie = lookup_context_die (DECL_CONTEXT (tdecl))))
+ {
+ /* Creating a full DIE for tdecl is overly expensive and
+ at this point even wrong when in the LTO phase
+ as it can end up generating new type DIEs we didn't
+ output and thus optimize_external_refs will crash. */
+ tdie = new_die (DW_TAG_subprogram, cdie, NULL_TREE);
+ add_AT_flag (tdie, DW_AT_external, 1);
+ add_AT_flag (tdie, DW_AT_declaration, 1);
+ add_linkage_attr (tdie, tdecl);
+ add_name_and_src_coords_attributes (tdie, tdecl);
+ equate_decl_number_to_die (tdecl, tdie);
+ }
}
if (tdie)
{
if (node->analyzed
&& (!DECL_EXTERNAL (node->symbol.decl)
|| node->alias
- || before_inlining_p))
+ || (before_inlining_p
+ && (cgraph_state < CGRAPH_STATE_IPA_SSA
+ || !lookup_attribute
+ ("always_inline",
+ DECL_ATTRIBUTES (node->symbol.decl))))))
pointer_set_insert (reachable, node);
enqueue_node ((symtab_node) node, first, reachable);
}
fprintf (file, " %s", cgraph_node_name (node));
node->alias = false;
node->thunk.thunk_p = false;
+ /* After early inlining we drop always_inline attributes on
+ bodies of functions that are still referenced (have their
+ address taken). */
+ DECL_ATTRIBUTES (node->symbol.decl)
+ = remove_attribute ("always_inline",
+ DECL_ATTRIBUTES (node->symbol.decl));
cgraph_node_remove_callees (node);
ipa_remove_all_references (&node->symbol.ref_list);
changed = true;
+2015-06-11 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2014-04-04 Jan Hubicka <hubicka@ucw.cz>
+
+ PR ipa/59626
+ * gcc.dg/lto/pr59626_0.c: New testcase.
+ * gcc.dg/lto/pr59626_1.c: New testcase.
+
2015-06-10 Richard Biener <rguenther@suse.de>
Backport from mainline
--- /dev/null
+/* { dg-lto-do run } */
+
+int __atoi (const char *) __asm__("atoi");
+extern inline __attribute__((always_inline,gnu_inline))
+int atoi (const char *x)
+{
+ return __atoi (x);
+}
+
+int bar (int (*)(const char *));
+
+int main()
+{
+ return bar (atoi);
+}
--- /dev/null
+int bar (int (*fn)(const char *))
+{
+ return fn ("0");
+}