diff options
author | Jan Hubicka <jh@suse.cz> | 2007-09-04 18:07:50 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2007-09-04 16:07:50 +0000 |
commit | 4d4b8cb9c0f82c22252018b1b25cd8b3c63166b3 (patch) | |
tree | 75c149d77b7daa8ab6ece4c2f7b9b97094602534 /gcc/ipa-inline.c | |
parent | 4c5bae34c163fa87e5c137e71d4be728d4b21291 (diff) | |
download | gcc-4d4b8cb9c0f82c22252018b1b25cd8b3c63166b3.tar.gz |
re PR middle-end/29478 (optimization generates warning for casts)
* gcc.dg/tree-ssa/loadpre8.c: Disable inlining.
* gcc.dg/tree-ssa/pr27236.c: Likewise.
* gcc.dg/tree-ssa/predcom-1.c: Likewise.
* gcc.dg/tree-ssa/predcom-2.c: Likewise.
* gcc.dg/tree-ssa/flatten-2.c: Avoid overactive tail call ellim.
* gcc.dg/tree-ssa/loadpre5.c: Likewise.
* gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c:
Likewise.
* invoke.texi (-finline-small-functions): Document.
* ipa-inline.c (cgraph_default_inline_p): Do not use DECL_INLINE
when deciding what is inlinable.
(cgraph_decide_recursive_inlining): Handle flag_inline_functions.
(cgraph_decide_inlining_of_small_function): Handle new flags.
(cgraph_decide_inlining_incrementally): Likewise.
* opts.c (decode_options): Enable flag_inline_small_functions at -O2
* common.opt (finline-small-functions): New.
* Makefile.in (build/gengtype.o-warn): Work around PR29478
From-SVN: r128092
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r-- | gcc/ipa-inline.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 647ec9faded..2ea5f73cdc9 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -404,10 +404,10 @@ cgraph_default_inline_p (struct cgraph_node *n, const char **reason) if (n->inline_decl) decl = n->inline_decl; - if (!DECL_INLINE (decl)) + if (!flag_inline_small_functions && !DECL_DECLARED_INLINE_P (decl)) { if (reason) - *reason = N_("function not inlinable"); + *reason = N_("function not inline candidate"); return false; } @@ -666,7 +666,8 @@ cgraph_decide_recursive_inlining (struct cgraph_node *node) int depth = 0; int n = 0; - if (optimize_size) + if (optimize_size + || (!flag_inline_functions && !DECL_DECLARED_INLINE_P (node->decl))) return false; if (DECL_DECLARED_INLINE_P (node->decl)) @@ -863,6 +864,7 @@ cgraph_decide_inlining_of_small_functions (void) struct cgraph_node *where; int growth = cgraph_estimate_size_after_inlining (1, edge->caller, edge->callee); + const char *not_good = NULL; growth -= edge->caller->global.insns; @@ -916,13 +918,19 @@ cgraph_decide_inlining_of_small_functions (void) } } - if ((!cgraph_maybe_hot_edge_p (edge) || optimize_size) && growth > 0) + if (!cgraph_maybe_hot_edge_p (edge)) + not_good = N_("call is unlikely and code size would grow"); + if (!flag_inline_functions + && !DECL_DECLARED_INLINE_P (edge->callee->decl)) + not_good = N_("function not declared inline and code size would grow"); + if (optimize_size) + not_good = N_("optimizing for size and code size would grow"); + if (not_good && growth > 0) { if (!cgraph_recursive_inlining_p (edge->caller, edge->callee, &edge->inline_failed)) { - edge->inline_failed = - N_("call is unlikely"); + edge->inline_failed = not_good; if (dump_file) fprintf (dump_file, " inline_failed:%s.\n", edge->inline_failed); } @@ -1363,7 +1371,9 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node, /* When the function body would grow and inlining the function won't eliminate the need for offline copy of the function, don't inline. */ - if (mode == INLINE_SIZE + if ((mode == INLINE_SIZE + || (!flag_inline_functions + && !DECL_DECLARED_INLINE_P (e->callee->decl))) && (cgraph_estimate_size_after_inlining (1, e->caller, e->callee) > e->caller->global.insns) && cgraph_estimate_growth (e->callee) > 0) |