ipa-inline.c (want_inline_small_function_p): Compute big_speedup_p lazily and last.
authorRichard Biener <rguenther@suse.de>
Wed, 7 Nov 2018 13:18:36 +0000 (13:18 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 7 Nov 2018 13:18:36 +0000 (13:18 +0000)
2018-11-07  Richard Biener  <rguenther@suse.de>

* ipa-inline.c (want_inline_small_function_p): Compute
big_speedup_p lazily and last.

From-SVN: r265873

gcc/ChangeLog
gcc/ipa-inline.c

index f8295d5..899e3fa 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-07  Richard Biener  <rguenther@suse.de>
+
+       * ipa-inline.c (want_inline_small_function_p): Compute
+       big_speedup_p lazily and last.
+
 2018-11-07  Jan Hubicka  <jh@suse.cz>
 
        * tree.c (fld_type_variant_equal_p): Skip TYPE_ALIGN check when
index 4f8ed15..bcd1653 100644 (file)
@@ -779,7 +779,7 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
     {
       int growth = estimate_edge_growth (e);
       ipa_hints hints = estimate_edge_hints (e);
-      bool big_speedup = big_speedup_p (e);
+      int big_speedup = -1; /* compute this lazily */
 
       if (growth <= 0)
        ;
@@ -787,13 +787,13 @@ 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->decl)
               && growth >= MAX_INLINE_INSNS_SINGLE
-              && ((!big_speedup
-                   && !(hints & (INLINE_HINT_indirect_call
+              && (growth >= MAX_INLINE_INSNS_SINGLE * 16
+                  || (!(hints & (INLINE_HINT_indirect_call
                                  | INLINE_HINT_known_hot
                                  | INLINE_HINT_loop_iterations
                                  | INLINE_HINT_array_index
-                                 | INLINE_HINT_loop_stride)))
-                  || growth >= MAX_INLINE_INSNS_SINGLE * 16))
+                                 | INLINE_HINT_loop_stride))
+                      && !(big_speedup = big_speedup_p (e)))))
        {
           e->inline_failed = CIF_MAX_INLINE_INSNS_SINGLE_LIMIT;
          want_inline = false;
@@ -813,7 +813,6 @@ 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->decl)
-              && !big_speedup
               && !(hints & INLINE_HINT_known_hot)
               && growth >= ((hints & (INLINE_HINT_indirect_call
                                       | INLINE_HINT_loop_iterations
@@ -821,7 +820,8 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
                                       | INLINE_HINT_loop_stride))
                             ? MAX (MAX_INLINE_INSNS_AUTO,
                                    MAX_INLINE_INSNS_SINGLE)
-                            : MAX_INLINE_INSNS_AUTO))
+                            : MAX_INLINE_INSNS_AUTO)
+              && !(big_speedup == -1 ? big_speedup_p (e) : big_speedup))
        {
          /* growth_likely_positive is expensive, always test it last.  */
           if (growth >= MAX_INLINE_INSNS_SINGLE