diff options
author | Jan Hubicka <jh@suse.cz> | 2013-07-25 15:24:58 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-07-25 13:24:58 +0000 |
commit | 4f63dfc6ad7071c758a15ee4028da7ef3a14b9e1 (patch) | |
tree | 14aa9bef47ee98d36445bd25cd1f85866bad036d /gcc/ipa.c | |
parent | e6dcfa183238b81d4e69669cb091a09f116db8e7 (diff) | |
download | gcc-4f63dfc6ad7071c758a15ee4028da7ef3a14b9e1.zip gcc-4f63dfc6ad7071c758a15ee4028da7ef3a14b9e1.tar.gz gcc-4f63dfc6ad7071c758a15ee4028da7ef3a14b9e1.tar.bz2 |
lto-symtab.c (lto_cgraph_replace_node): Release function body.
* lto-symtab.c (lto_cgraph_replace_node): Release function body.
* cgraph.c (cgraph_remove_node): Do not release function body
when in cgraph streaming.
* ipa.c (process_references, symtab_remove_unreachable_nodes): Objects
in other partitions are not considered reachable; fix handling of clones.
From-SVN: r201242
Diffstat (limited to 'gcc/ipa.c')
-rw-r--r-- | gcc/ipa.c | 38 |
1 files changed, 22 insertions, 16 deletions
@@ -138,7 +138,7 @@ process_references (struct ipa_ref_list *list, { symtab_node node = ref->referred; - if (node->symbol.definition + if (node->symbol.definition && !node->symbol.in_other_partition && ((!DECL_EXTERNAL (node->symbol.decl) || node->symbol.alias) || (before_inlining_p /* We use variable constructors during late complation for @@ -236,6 +236,7 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) cgraph_can_remove_if_no_direct_calls_and_refs_p should not be called on them. */ FOR_EACH_DEFINED_FUNCTION (node) if (!node->global.inlined_to + && !node->symbol.in_other_partition && (!cgraph_can_remove_if_no_direct_calls_and_refs_p (node) /* Keep around virtual functions for possible devirtualization. */ || (before_inlining_p @@ -250,7 +251,8 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) /* Mark variables that are obviously needed. */ FOR_EACH_DEFINED_VARIABLE (vnode) - if (!varpool_can_remove_if_no_refs (vnode)) + if (!varpool_can_remove_if_no_refs (vnode) + && !vnode->symbol.in_other_partition) { pointer_set_insert (reachable, vnode); enqueue_node ((symtab_node)vnode, &first, reachable); @@ -296,6 +298,7 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) for (e = cnode->callees; e; e = e->next_callee) { if (e->callee->symbol.definition + && !e->callee->symbol.in_other_partition && (!e->inline_failed || !DECL_EXTERNAL (e->callee->symbol.decl) || e->callee->symbol.alias @@ -306,22 +309,20 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) /* When inline clone exists, mark body to be preserved so when removing offline copy of the function we don't kill it. */ - if (!cnode->symbol.alias && cnode->global.inlined_to) + if (cnode->global.inlined_to) pointer_set_insert (body_needed_for_clonning, cnode->symbol.decl); - } - /* For non-inline clones, force their origins to the boundary and ensure - that body is not removed. */ - while (cnode->clone_of - && !gimple_has_body_p (cnode->symbol.decl)) - { - bool noninline = cnode->clone_of->symbol.decl != cnode->symbol.decl; - cnode = cnode->clone_of; - if (noninline) - { - pointer_set_insert (body_needed_for_clonning, cnode->symbol.decl); - enqueue_node ((symtab_node)cnode, &first, reachable); - break; + /* For non-inline clones, force their origins to the boundary and ensure + that body is not removed. */ + while (cnode->clone_of) + { + bool noninline = cnode->clone_of->symbol.decl != cnode->symbol.decl; + cnode = cnode->clone_of; + if (noninline) + { + pointer_set_insert (body_needed_for_clonning, cnode->symbol.decl); + enqueue_node ((symtab_node)cnode, &first, reachable); + } } } } @@ -358,6 +359,8 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) { if (!pointer_set_contains (body_needed_for_clonning, node->symbol.decl)) cgraph_release_function_body (node); + else if (!node->clone_of) + gcc_assert (DECL_RESULT (node->symbol.decl)); if (node->symbol.definition) { if (file) @@ -366,6 +369,9 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) changed = true; } } + else + gcc_assert (node->clone_of || !cgraph_function_with_gimple_body_p (node) + || DECL_RESULT (node->symbol.decl)); } /* Inline clones might be kept around so their materializing allows further |