diff options
author | Martin Jambor <mjambor@suse.cz> | 2019-07-26 10:44:51 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2019-07-26 10:44:51 +0200 |
commit | 4517b378af6b412e053e8927972434d8580162d0 (patch) | |
tree | 8ba242b52d8258623593e284cd0ffb7d7618141e /gcc/ipa-inline.c | |
parent | ac2dca4daf516c6972df1f5ef66e64b3c8f12bc2 (diff) | |
download | gcc-4517b378af6b412e053e8927972434d8580162d0.zip gcc-4517b378af6b412e053e8927972434d8580162d0.tar.gz gcc-4517b378af6b412e053e8927972434d8580162d0.tar.bz2 |
[PR 89330] Remove non-useful speculations from new_edges
2019-07-26 Martin Jambor <mjambor@suse.cz>
PR ipa/89330
* ipa-inline-transform.c (check_speculations_1): New function.
(push_all_edges_in_set_to_vec): Likewise.
(check_speculations): Use check_speculations_1, new parameter
new_edges.
(inline_call): Pass new_edges to check_speculations.
* ipa-inline.c (add_new_edges_to_heap): Assert edge_callee is not
NULL.
(speculation_useful_p): Early return true if edge is inlined, remove
later checks for inline_failed.
testsuite/
* g++.dg/lto/pr89330_[01].C: New test.
* g++.dg/tree-prof/devirt.C: Added -fno-profile-values to dg-options.
From-SVN: r273825
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r-- | gcc/ipa-inline.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 0ed965a..b62d280 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -1629,6 +1629,7 @@ add_new_edges_to_heap (edge_heap_t *heap, vec<cgraph_edge *> new_edges) struct cgraph_edge *edge = new_edges.pop (); gcc_assert (!edge->aux); + gcc_assert (edge->callee); if (edge->inline_failed && can_inline_edge_p (edge, true) && want_inline_small_function_p (edge, true) @@ -1656,6 +1657,10 @@ heap_edge_removal_hook (struct cgraph_edge *e, void *data) bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining) { + /* If we have already decided to inline the edge, it seems useful. */ + if (!e->inline_failed) + return true; + enum availability avail; struct cgraph_node *target = e->callee->ultimate_alias_target (&avail, e->caller); @@ -1690,12 +1695,11 @@ speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining) to an ipa-cp clone (that are seen by having local flag set), it is probably pointless to inline it unless hardware is missing indirect call predictor. */ - if (!anticipate_inlining && e->inline_failed && !target->local.local) + if (!anticipate_inlining && !target->local.local) return false; /* For overwritable targets there is not much to do. */ - if (e->inline_failed - && (!can_inline_edge_p (e, false) - || !can_inline_edge_by_limits_p (e, false, true))) + if (!can_inline_edge_p (e, false) + || !can_inline_edge_by_limits_p (e, false, true)) return false; /* OK, speculation seems interesting. */ return true; |