From 1e29e4d36f701712b541e989ff091d7a6ce1afcd Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 10 Dec 2014 22:17:28 +0100 Subject: invoke.texi: (-devirtualize-at-ltrans): Document. * doc/invoke.texi: (-devirtualize-at-ltrans): Document. * lto-cgraph.c (lto_output_varpool_node): Mark initializer as removed when it is not streamed to the given ltrans. (compute_ltrans_boundary): Make code adding all polymorphic call targets conditional with !flag_wpa || flag_ltrans_devirtualize. * common.opt (fdevirtualize-at-ltrans): New flag. From-SVN: r218609 --- gcc/lto-cgraph.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'gcc/lto-cgraph.c') diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index b310b44..cf92892 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -615,7 +615,8 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node, bp_pack_value (&bp, node->force_output, 1); bp_pack_value (&bp, node->forced_by_abi, 1); bp_pack_value (&bp, node->unique_name, 1); - bp_pack_value (&bp, node->body_removed, 1); + bp_pack_value (&bp, node->body_removed + || !lto_symtab_encoder_encode_initializer_p (encoder, node), 1); bp_pack_value (&bp, node->implicit_section, 1); bp_pack_value (&bp, node->writeonly, 1); bp_pack_value (&bp, node->definition, 1); @@ -910,8 +911,11 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) { if (!lto_symtab_encoder_encode_initializer_p (encoder, vnode) - && (vnode->ctor_useable_for_folding_p () - || POINTER_BOUNDS_P (vnode->decl))) + && (((vnode->ctor_useable_for_folding_p () + && (!DECL_VIRTUAL_P (vnode->decl) + || !flag_wpa + || flag_ltrans_devirtualize)) + || POINTER_BOUNDS_P (vnode->decl)))) { lto_set_symtab_encoder_encode_initializer (encoder, vnode); create_references (encoder, vnode); @@ -936,7 +940,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) } } /* Add all possible targets for late devirtualization. */ - if (flag_devirtualize) + if (flag_ltrans_devirtualize || !flag_wpa) for (edge = node->indirect_calls; edge; edge = edge->next_callee) if (edge->indirect_info->polymorphic) { -- cgit v1.1