diff options
author | Jan Hubicka <jh@suse.cz> | 2010-08-21 11:46:15 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-08-21 09:46:15 +0000 |
commit | 508e475706c3560a86b08446e1bb764773b93ed9 (patch) | |
tree | dd592015baf43a7ac0105edb4a35dc0cecd6d50f /gcc/cgraph.h | |
parent | f1395d4a6e0ea98b1fa3b72d40f02fcba9801500 (diff) | |
download | gcc-508e475706c3560a86b08446e1bb764773b93ed9.tar.gz |
re PR middle-end/45307 (Stores expanding to no RTL not removed by tree optimizers, Empty ctors/dtors not eliminated)
PR c++/45307
PR c++/17736
* cgraph.h (cgraph_only_called_directly_p,
cgraph_can_remove_if_no_direct_calls_and_refs_p): Handle
static cdtors.
* cgraphunit.c (cgraph_decide_is_function_needed): Static cdtors
are not needed.
(cgraph_finalize_function): Static cdtors are reachable.
(cgraph_mark_functions_to_output): Use cgraph_only_called_directly_p.
* gcc.dg/ipa/ctor-empty-1.c: Add testcase.
* g++.dg/tree-ssa/empty-2.C: Check that constructor got optimized out.
From-SVN: r163439
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r-- | gcc/cgraph.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 2dcdf2f22f3..f77a280d12f 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -608,6 +608,10 @@ void cgraph_set_looping_const_or_pure_flag (struct cgraph_node *, bool); tree clone_function_name (tree decl, const char *); bool cgraph_node_cannot_return (struct cgraph_node *); bool cgraph_edge_cannot_lead_to_return (struct cgraph_edge *); +bool cgraph_will_be_removed_from_program_if_no_direct_calls + (struct cgraph_node *node); +bool cgraph_can_remove_if_no_direct_calls_and_refs_p + (struct cgraph_node *node); /* In cgraphunit.c */ extern FILE *cgraph_dump_file; @@ -664,8 +668,6 @@ void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *); void cgraph_materialize_all_clones (void); gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *); bool cgraph_propagate_frequency (struct cgraph_node *node); -bool cgraph_will_be_removed_from_program_if_no_direct_calls - (struct cgraph_node *node); /* In cgraphbuild.c */ unsigned int rebuild_cgraph_edges (void); void cgraph_rebuild_references (void); @@ -903,17 +905,11 @@ varpool_node_set_nonempty_p (varpool_node_set set) static inline bool cgraph_only_called_directly_p (struct cgraph_node *node) { - return !node->needed && !node->address_taken && !node->local.externally_visible; -} - -/* Return true when function NODE can be removed from callgraph - if all direct calls are eliminated. */ - -static inline bool -cgraph_can_remove_if_no_direct_calls_and_refs_p (struct cgraph_node *node) -{ - return (!node->needed && !node->reachable_from_other_partition - && (DECL_COMDAT (node->decl) || !node->local.externally_visible)); + return (!node->needed && !node->address_taken + && !node->reachable_from_other_partition + && !DECL_STATIC_CONSTRUCTOR (node->decl) + && !DECL_STATIC_DESTRUCTOR (node->decl) + && !node->local.externally_visible); } /* Return true when function NODE can be removed from callgraph |