From 1d9fec7937f45dde5e04cac966a2d9a12f2fc15a Mon Sep 17 00:00:00 2001 From: Yiran Wang Date: Tue, 23 Jun 2015 15:33:17 -0700 Subject: Synchronize with google/gcc-4_9 to r224707 (from r214835) Change-Id: I3d6f06fc613c8f8b6a82143dc44b7338483aac5d --- gcc-4.9/gcc/ipa-inline.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'gcc-4.9/gcc/ipa-inline.c') diff --git a/gcc-4.9/gcc/ipa-inline.c b/gcc-4.9/gcc/ipa-inline.c index 29c76b88e..c116f740f 100644 --- a/gcc-4.9/gcc/ipa-inline.c +++ b/gcc-4.9/gcc/ipa-inline.c @@ -501,7 +501,7 @@ want_early_inline_function_p (struct cgraph_edge *e) growth); want_inline = false; } - else if (DECL_COMDAT (callee->decl) + else if (!flag_auto_profile && DECL_COMDAT (callee->decl) && growth <= PARAM_VALUE (PARAM_EARLY_INLINING_INSNS_COMDAT)) ; else if ((n = num_calls (callee)) != 0 @@ -728,13 +728,25 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report) else if (!DECL_DECLARED_INLINE_P (callee->decl) && !flag_inline_functions) { - /* growth_likely_positive is expensive, always test it last. */ - if (growth >= MAX_INLINE_INSNS_SINGLE - || growth_likely_positive (callee, growth)) - { + /* For functions not declared inline, if it has big_speedup + or has good hints for performance and the size growth is + small, they are profitable to inline. */ + if (big_speedup + || (hints & (INLINE_HINT_indirect_call + | INLINE_HINT_loop_iterations + | INLINE_HINT_array_index + | INLINE_HINT_loop_stride))) + { + if (growth >= MAX_GROWTH_AUTO_INLINE_FUNC) + want_inline = false; + } + /* growth_likely_positive is expensive, always test it last. */ + else if (growth >= MAX_INLINE_INSNS_SINGLE + || growth_likely_positive (callee, growth)) + { e->inline_failed = CIF_NOT_DECLARED_INLINED; - want_inline = false; - } + want_inline = false; + } } /* Apply MAX_INLINE_INSNS_AUTO limit for functions not declared inline Upgrade it to MAX_INLINE_INSNS_SINGLE when hints suggests that -- cgit v1.2.3