aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-11-08 17:46:18 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2012-11-08 16:46:18 +0000
commit42f7b0fa26c75f33090cf515c9f849c528ebca84 (patch)
treec2cbdda2703ae2ef2cd29bf2ad23bf0a190b8d81 /gcc/ipa-inline.c
parent774b8a558c2fbfe0b472c814d582c8540102a17c (diff)
downloadgcc-42f7b0fa26c75f33090cf515c9f849c528ebca84.zip
gcc-42f7b0fa26c75f33090cf515c9f849c528ebca84.tar.gz
gcc-42f7b0fa26c75f33090cf515c9f849c528ebca84.tar.bz2
re PR fortran/48636 (Enable more inlining with -O2 and higher)
PR middle-end/48636 * ipa-inline.c (big_speedup_p): New function. (want_inline_small_function_p): Use it. (edge_badness): Dump it. * params.def (inline-min-speedup): New parameter. * doc/invoke.texi (inline-min-speedup): Document. From-SVN: r193331
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 4b70579..fa3d456 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -493,6 +493,22 @@ compute_inlined_call_time (struct cgraph_edge *edge,
return time;
}
+/* Return true if the speedup for inlining E is bigger than
+ PARAM_MAX_INLINE_MIN_SPEEDUP. */
+
+static bool
+big_speedup_p (struct cgraph_edge *e)
+{
+ gcov_type time = compute_uninlined_call_time (inline_summary (e->callee),
+ e);
+ gcov_type inlined_time = compute_inlined_call_time (e,
+ estimate_edge_time (e));
+ if (time - inlined_time
+ > RDIV (time * PARAM_VALUE (PARAM_INLINE_MIN_SPEEDUP), 100))
+ return true;
+ return false;
+}
+
/* Return true if we are interested in inlining small function.
When REPORT is true, report reason to dump file. */
@@ -514,6 +530,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
{
int growth = estimate_edge_growth (e);
inline_hints hints = estimate_edge_hints (e);
+ bool big_speedup = big_speedup_p (e);
if (growth <= 0)
;
@@ -521,6 +538,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
hints suggests that inlining given function is very profitable. */
else if (DECL_DECLARED_INLINE_P (callee->symbol.decl)
&& growth >= MAX_INLINE_INSNS_SINGLE
+ && !big_speedup
&& !(hints & (INLINE_HINT_indirect_call
| INLINE_HINT_loop_iterations
| INLINE_HINT_loop_stride)))
@@ -574,6 +592,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
Upgrade it to MAX_INLINE_INSNS_SINGLE when hints suggests that
inlining given function is very profitable. */
else if (!DECL_DECLARED_INLINE_P (callee->symbol.decl)
+ && !big_speedup
&& growth >= ((hints & (INLINE_HINT_indirect_call
| INLINE_HINT_loop_iterations
| INLINE_HINT_loop_stride))
@@ -836,6 +855,8 @@ edge_badness (struct cgraph_edge *edge, bool dump)
growth,
edge_time);
dump_inline_hints (dump_file, hints);
+ if (big_speedup_p (edge))
+ fprintf (dump_file, " big_speedup");
fprintf (dump_file, "\n");
}