aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-cgraph.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-08-06 18:59:49 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-08-06 16:59:49 +0000
commita2e2a66815796bd961250264ff32809bae478a31 (patch)
treee06c2e69d4ad72b54dff08acfb5ac74d389b8f74 /gcc/lto-cgraph.c
parente086adbdb433ea655c8bf0bdcd210baa5a0a63f6 (diff)
downloadgcc-a2e2a66815796bd961250264ff32809bae478a31.zip
gcc-a2e2a66815796bd961250264ff32809bae478a31.tar.gz
gcc-a2e2a66815796bd961250264ff32809bae478a31.tar.bz2
cgraph.c (cgraph_get_body): New function based on lto.c implementation.
* cgraph.c (cgraph_get_body): New function based on lto.c implementation. * cgraph.h (cgraph_get_body): Declare. * cgraphclones.c (cgraph_create_virtual_clone): Commonize WPA and LTO paths. * cgraphunit.c (expand_function): Get body prior expanding. * ipa.c (function_and_variable_visibility): Use gimple_has_body_p test. * lto-cgraph.c (lto_output_node): Do not stream bodies we don't really need. * passes.c (do_per_function_toporder): Get body. * tree-inline.c (expand_call_inline): Get body prior inlining it. * tree-ssa-structalias.c (ipa_pta_execute): Get body; skip clones. * lto.c (lto_materialize_function): Do not read body anymore. From-SVN: r201537
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r--gcc/lto-cgraph.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 0dde03a..51dc705 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -376,7 +376,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
bool boundary_p;
intptr_t ref;
bool in_other_partition = false;
- struct cgraph_node *clone_of;
+ struct cgraph_node *clone_of, *ultimate_clone_of;
struct ipa_opt_pass_d *pass;
int i;
bool alias_p;
@@ -423,7 +423,16 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
else
clone_of = clone_of->clone_of;
- if (LTO_symtab_analyzed_node)
+ /* See if body of the master function is output. If not, we are seeing only
+ an declaration and we do not need to pass down clone tree. */
+ ultimate_clone_of = clone_of;
+ while (ultimate_clone_of && ultimate_clone_of->clone_of)
+ ultimate_clone_of = ultimate_clone_of->clone_of;
+
+ if (clone_of && !lto_symtab_encoder_encode_body_p (encoder, ultimate_clone_of))
+ clone_of = NULL;
+
+ if (tag == LTO_symtab_analyzed_node)
gcc_assert (clone_of || !node->clone_of);
if (!clone_of)
streamer_write_hwi_stream (ob->main_stream, LCC_NOT_FOUND);