diff options
author | Jan Hubicka <jh@suse.cz> | 2010-07-08 18:46:49 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-07-08 16:46:49 +0000 |
commit | 09411461d2e1d7dfcc3aed713bddc68e34ba223d (patch) | |
tree | bc5d1a43aa025755bcaa3455dd75d5fff8fd479a /gcc/cgraph.c | |
parent | 72109b25534c8471768fa2765bebe7c62420e059 (diff) | |
download | gcc-09411461d2e1d7dfcc3aed713bddc68e34ba223d.zip gcc-09411461d2e1d7dfcc3aed713bddc68e34ba223d.tar.gz gcc-09411461d2e1d7dfcc3aed713bddc68e34ba223d.tar.bz2 |
cgraph.c (cgraph_will_be_removed_from_program_if_no_direct_calls): New function.
* cgraph.c (cgraph_will_be_removed_from_program_if_no_direct_calls):
New function.
* cgraph.h (cgraph_will_be_removed_from_program_if_no_direct_calls):
Declare.
* ipa-cp.c (ipcp_estimate_growth): Use it.
* ipa-inline.c (cgraph_estimate_growth, cgraph_decide_inlining):
Likewise.
From-SVN: r161966
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 33653df..fff437a 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2651,4 +2651,29 @@ cgraph_edge_cannot_lead_to_return (struct cgraph_edge *e) return cgraph_node_cannot_return (e->callee); } +/* Return true when function NODE can be excpected to be removed + from program when direct calls in this compilation unit are removed. + + As a special case COMDAT functions are + cgraph_can_remove_if_no_direct_calls_p while the are not + cgraph_only_called_directly_p (it is possible they are called from other + unit) + + This function behaves as cgraph_only_called_directly_p because eliminating + all uses of COMDAT function does not make it neccesarily disappear from + the program unless we are compiling whole program or we do LTO. In this + case we know we win since dynamic linking will not really discard the + linkonce section. */ + +bool +cgraph_will_be_removed_from_program_if_no_direct_calls (struct cgraph_node *node) +{ + if (node->local.used_from_object_file) + return false; + if (!in_lto_p && !flag_whole_program) + return cgraph_only_called_directly_p (node); + else + return cgraph_can_remove_if_no_direct_calls_p (node); +} + #include "gt-cgraph.h" |