diff options
author | Jan Hubicka <jh@suse.cz> | 2013-09-10 15:50:43 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-09-10 13:50:43 +0000 |
commit | 82d618d375a1daeab6f22a3f6117f2d7244d966f (patch) | |
tree | 4e484620bb234edab10a6d6a34b6eedbf439da8b /gcc/lto-cgraph.c | |
parent | 668b689457961fbcbd6c140aea21d03729a844e7 (diff) | |
download | gcc-82d618d375a1daeab6f22a3f6117f2d7244d966f.zip gcc-82d618d375a1daeab6f22a3f6117f2d7244d966f.tar.gz gcc-82d618d375a1daeab6f22a3f6117f2d7244d966f.tar.bz2 |
lto-cgraph.c: Include ipa-utils.h.
* lto-cgraph.c: Include ipa-utils.h.
(compute_ltrans_boundary): Also add possible targets into the boundary.
From-SVN: r202447
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r-- | gcc/lto-cgraph.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index fcba1b9..4eb443b 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see #include "profile.h" #include "context.h" #include "pass_manager.h" +#include "ipa-utils.h" static void output_cgraph_opt_summary (void); static void input_cgraph_opt_summary (vec<symtab_node> nodes); @@ -766,6 +767,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) int i; lto_symtab_encoder_t encoder; lto_symtab_encoder_iterator lsei; + struct pointer_set_t *reachable_call_targets = pointer_set_create (); encoder = lto_symtab_encoder_new (false); @@ -837,9 +839,40 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) add_node_to (encoder, callee, false); } } + /* Add all possible targets for late devirtualization. */ + if (flag_devirtualize) + for (edge = node->indirect_calls; edge; edge = edge->next_callee) + if (edge->indirect_info->polymorphic) + { + unsigned int i; + void *cache_token; + bool final; + vec <cgraph_node *>targets + = possible_polymorphic_call_targets + (edge, &final, &cache_token); + if (!pointer_set_insert (reachable_call_targets, + cache_token)) + { + for (i = 0; i < targets.length(); i++) + { + struct cgraph_node *callee = targets[i]; + + /* Adding an external declarations into the unit serves + no purpose and just increases its boundary. */ + if (callee->symbol.definition + && !lto_symtab_encoder_in_partition_p + (encoder, (symtab_node)callee)) + { + gcc_assert (!callee->global.inlined_to); + add_node_to (encoder, callee, false); + } + } + } + } } - lto_symtab_encoder_delete (in_encoder); - return encoder; + lto_symtab_encoder_delete (in_encoder); + pointer_set_destroy (reachable_call_targets); + return encoder; } /* Output the part of the symtab in SET and VSET. */ |