summaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-10 21:58:49 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-12-10 21:58:49 +0000
commit61c2c7b1e5623d1add0d7281d218f0073dab1943 (patch)
treed4a06720c9f0e8aaf194c011c4b0206f944bc2fd /gcc/ipa-inline.c
parentb40f32911ae98b5a47519d35f09d6ed0b720bb3b (diff)
downloadgcc-61c2c7b1e5623d1add0d7281d218f0073dab1943.tar.gz
PR c++/42317
* cgraph.h (struct cgraph_node): Add same_comdat_group field. * cgraph.c (cgraph_remove_node): Unchain node from same_comdat_group circular list. (cgraph_node_can_be_local_p): Return false for DECL_COMDAT with node->same_comdat_group. * ipa.c (cgraph_remove_unreachable_nodes): For any reachable node mark all its same_comdat_group nodes as also reachable. (cgraph_externally_visible_p): Return true even if any of same_comdat_group nodes has address taken. * lto-cgraph.c (lto_output_node): Stream out same_comdat_group. (output_cgraph): Ensure other same_comdat_group nodes are also included. (input_node): Stream in same_comdat_group. (input_cgraph_1): Fix up same_comdat_group fields from references to pointers. * cgraphunit.c (cgraph_analyze_functions): Mark all other same_comdat_group nodes as reachable. (cgraph_mark_functions_to_output): For each node->process process also other same_comdat_group nodes. * ipa-inline.c (cgraph_clone_inlined_nodes): Don't reuse nodes with same_comdat_group non-NULL. (cgraph_mark_inline_edge): Likewise. * decl2.c (cp_write_global_declarations): Clear DECL_EXTERNAL also on all other functions in the same comdat group. * optimize.c (maybe_clone_body): Also optimize virtual implicit dtors. For virtual comdat dtors tell cgraph that base and deleting dtor are in the same comdat group. * config/abi/pre/gnu.ver: Don't export certain base dtors that weren't previously exported. * g++.dg/opt/dtor2.C: New test. * g++.dg/opt/dtor2.h: New file. * g++.dg/opt/dtor2-aux.cc: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155143 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 120c234f89b..b146d0b13e2 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -247,6 +247,10 @@ cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
In that case just go ahead and re-use it. */
if (!e->callee->callers->next_caller
&& cgraph_can_remove_if_no_direct_calls_p (e->callee)
+ /* Don't reuse if more than one function shares a comdat group.
+ If the other function(s) are needed, we need to emit even
+ this function out of line. */
+ && !e->callee->same_comdat_group
&& !cgraph_new_nodes)
{
gcc_assert (!e->callee->global.inlined_to);
@@ -311,7 +315,8 @@ cgraph_mark_inline_edge (struct cgraph_edge *e, bool update_original,
e->callee->global.inlined = true;
if (e->callee->callers->next_caller
- || !cgraph_can_remove_if_no_direct_calls_p (e->callee))
+ || !cgraph_can_remove_if_no_direct_calls_p (e->callee)
+ || e->callee->same_comdat_group)
duplicate = true;
cgraph_clone_inlined_nodes (e, true, update_original);