summaryrefslogtreecommitdiff
path: root/gcc/ipa-inline-analysis.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-03-09 05:53:54 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-03-09 04:53:54 +0000
commite0d514da7ba05dabd279fee99a1ef8f40f098ab0 (patch)
tree4d0fa49deb182f96c355f84d405543db33394f5d /gcc/ipa-inline-analysis.c
parent68ca4ac90b7413e7007ae6b08d372205e42bdb7d (diff)
downloadgcc-e0d514da7ba05dabd279fee99a1ef8f40f098ab0.tar.gz
ipa-inline-analysis.c (check_callers): Check node->can_remove_if_no_direct_calls_and_refs_p.
* ipa-inline-analysis.c (check_callers): Check node->can_remove_if_no_direct_calls_and_refs_p. (growth_likely_positive): Reorganize to call can_remove_if_no_direct_calls_p later. * cgraph.h (will_be_removed_from_program_if_no_direct_calls_p, will_be_removed_from_program_if_no_direct_calls_p): Add will_inline parameter. * cgraph.c (cgraph_node::can_remove_if_no_direct_calls_p, cgraph_node::will_be_removed_from_program_if_no_direct_calls_p): Handle inliner case correctly. From-SVN: r221277
Diffstat (limited to 'gcc/ipa-inline-analysis.c')
-rw-r--r--gcc/ipa-inline-analysis.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index d7471630617..5707f6c9603 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -3978,6 +3978,9 @@ check_callers (cgraph_node *node, int *max_callers)
{
ipa_ref *ref;
+ if (!node->can_remove_if_no_direct_calls_and_refs_p ())
+ return true;
+
for (cgraph_edge *e = node->callers; e; e = e->next_caller)
{
(*max_callers)--;
@@ -4007,23 +4010,13 @@ growth_likely_positive (struct cgraph_node *node,
struct cgraph_edge *e;
gcc_checking_assert (edge_growth > 0);
+ /* First quickly check if NODE is removable at all. */
if (DECL_EXTERNAL (node->decl))
return true;
- /* Unlike for functions called once, we play unsafe with
- COMDATs. We can allow that since we know functions
- in consideration are small (and thus risk is small) and
- moreover grow estimates already accounts that COMDAT
- functions may or may not disappear when eliminated from
- current unit. With good probability making aggressive
- choice in all units is going to make overall program
- smaller. */
- if (DECL_COMDAT (node->decl))
- {
- if (!node->can_remove_if_no_direct_calls_p ())
- return true;
- }
- else if (!node->will_be_removed_from_program_if_no_direct_calls_p ())
+ if (!node->can_remove_if_no_direct_calls_and_refs_p ()
+ || node->address_taken)
return true;
+
max_callers = inline_summaries->get (node)->size * 4 / edge_growth + 2;
for (e = node->callers; e; e = e->next_caller)
@@ -4039,6 +4032,22 @@ growth_likely_positive (struct cgraph_node *node,
if (check_callers (dyn_cast <cgraph_node *> (ref->referring), &max_callers))
return true;
+ /* Unlike for functions called once, we play unsafe with
+ COMDATs. We can allow that since we know functions
+ in consideration are small (and thus risk is small) and
+ moreover grow estimates already accounts that COMDAT
+ functions may or may not disappear when eliminated from
+ current unit. With good probability making aggressive
+ choice in all units is going to make overall program
+ smaller. */
+ if (DECL_COMDAT (node->decl))
+ {
+ if (!node->can_remove_if_no_direct_calls_p ())
+ return true;
+ }
+ else if (!node->will_be_removed_from_program_if_no_direct_calls_p ())
+ return true;
+
return estimate_growth (node) > 0;
}