diff options
author | Richard Biener <rguenther@suse.de> | 2016-02-22 09:32:35 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-02-22 09:32:35 +0000 |
commit | bddead150b7e66b097f920b48980f0c65ff8e09e (patch) | |
tree | 5ac6f9056926a53719d7f72d459009fd358327cd /gcc/ipa-inline.c | |
parent | f97374a73fbd90651c925386234329d65d59ce80 (diff) | |
download | gcc-bddead150b7e66b097f920b48980f0c65ff8e09e.zip gcc-bddead150b7e66b097f920b48980f0c65ff8e09e.tar.gz gcc-bddead150b7e66b097f920b48980f0c65ff8e09e.tar.bz2 |
re PR middle-end/37448 (cannot compile big function)
2016-02-22 Richard Biener <rguenther@suse.de>
PR ipa/37448
* ipa-inline-transform.c (inline_call): When not updating
overall summaries adjust self size by the growth estimate.
* ipa-inline.c (inline_to_all_callers_1): Add to the callers
hash-set, do not update overall summaries here. Renamed from ...
(inline_to_all_callers): ... this which is now wrapping the
above and performing delayed overall summary update.
(early_inline_small_functions): Delay updating of the overall
summary.
From-SVN: r233598
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r-- | gcc/ipa-inline.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 07e661e..57a4588 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -2163,7 +2163,8 @@ flatten_function (struct cgraph_node *node, bool early) recursion. */ static bool -inline_to_all_callers (struct cgraph_node *node, void *data) +inline_to_all_callers_1 (struct cgraph_node *node, void *data, + hash_set<cgraph_node *> *callers) { int *num_calls = (int *)data; bool callee_removed = false; @@ -2193,7 +2194,10 @@ inline_to_all_callers (struct cgraph_node *node, void *data) inline_summaries->get (node->callers->caller)->size); } - inline_call (node->callers, true, NULL, NULL, true, &callee_removed); + /* Remember which callers we inlined to, delaying updating the + overall summary. */ + callers->add (node->callers->caller); + inline_call (node->callers, true, NULL, NULL, false, &callee_removed); if (dump_file) fprintf (dump_file, " Inlined into %s which now has %i size\n", @@ -2211,6 +2215,23 @@ inline_to_all_callers (struct cgraph_node *node, void *data) return false; } +/* Wrapper around inline_to_all_callers_1 doing delayed overall summary + update. */ + +static bool +inline_to_all_callers (struct cgraph_node *node, void *data) +{ + hash_set<cgraph_node *> callers; + bool res = inline_to_all_callers_1 (node, data, &callers); + /* Perform the delayed update of the overall summary of all callers + processed. This avoids quadratic behavior in the cases where + we have a lot of calls to the same function. */ + for (hash_set<cgraph_node *>::iterator i = callers.begin (); + i != callers.end (); ++i) + inline_update_overall_summary (*i); + return res; +} + /* Output overall time estimate. */ static void dump_overall_stats (void) @@ -2590,10 +2611,13 @@ early_inline_small_functions (struct cgraph_node *node) fprintf (dump_file, " Inlining %s into %s.\n", xstrdup_for_dump (callee->name ()), xstrdup_for_dump (e->caller->name ())); - inline_call (e, true, NULL, NULL, true); + inline_call (e, true, NULL, NULL, false); inlined = true; } + if (inlined) + inline_update_overall_summary (node); + return inlined; } |