opts.c (decode_options): Do not fiddle with inlining parameters in case of optimizing...
authorJan Hubicka <jh@suse.cz>
Fri, 4 May 2007 15:32:42 +0000 (17:32 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 4 May 2007 15:32:42 +0000 (15:32 +0000)
* opts.c (decode_options): Do not fiddle with inlining
parameters in case of optimizing for size.
* ipa-inline.c (cgraph_decide_recursive_inlining): When optimizing
for size do nothing.
(cgraph_decide_inlining_of_small_function): When optimizing for
size never inline functions increasing caller size.
(cgraph_early_inlining): Inline for size when optimizing for size.

Co-Authored-By: Richard Guenther <rguenther@suse.de>
From-SVN: r124431

gcc/ChangeLog
gcc/ipa-inline.c
gcc/opts.c

index 85404e0d12562d3172db03b1cdcc08b75fc45f24..853516859539272da3157b50e8c2fbdb1e025d49 100644 (file)
@@ -1,3 +1,14 @@
+2007-05-04  Jan Hubicka  <jh@suse.cz>
+           Richard Guenther  <rguenther@suse.de>
+
+       * opts.c (decode_options): Do not fiddle with inlining
+       parameters in case of optimizing for size.
+       * ipa-inline.c (cgraph_decide_recursive_inlining): When optimizing
+       for size do nothing.
+       (cgraph_decide_inlining_of_small_function): When optimizing for
+       size never inline functions increasing caller size.
+       (cgraph_early_inlining): Inline for size when optimizing for size.
+
 2007-04-18  Bernd Schmidt  <bernd.schmidt@analog.com>
 
        * config/bfin/bfin.md (<optab>di3): Now a define_expand which expands
index 04306aaa7e060c1731d2696ae4d0f44dc8dcf20e..076979ed5de2fb419fb7b6a2e7ebcd556607368a 100644 (file)
@@ -668,6 +668,9 @@ cgraph_decide_recursive_inlining (struct cgraph_node *node)
   int depth = 0;
   int n = 0;
 
+  if (optimize_size)
+    return false;
+
   if (DECL_DECLARED_INLINE_P (node->decl))
     {
       limit = PARAM_VALUE (PARAM_MAX_INLINE_INSNS_RECURSIVE);
@@ -913,7 +916,7 @@ cgraph_decide_inlining_of_small_functions (void)
            }
        }
 
-      if (!cgraph_maybe_hot_edge_p (edge) && growth > 0)
+      if ((!cgraph_maybe_hot_edge_p (edge) || optimize_size) && growth > 0)
        {
           if (!cgraph_recursive_inlining_p (edge->caller, edge->callee,
                                            &edge->inline_failed))
@@ -1444,7 +1447,7 @@ cgraph_early_inlining (void)
   if (sorrycount || errorcount)
     return 0;
   if (cgraph_decide_inlining_incrementally (node,
-                                           flag_unit_at_a_time
+                                           flag_unit_at_a_time || optimize_size
                                            ? INLINE_SIZE : INLINE_SPEED, 0))
     {
       timevar_push (TV_INTEGRATION);
index 0c4a1627e856a3a745d70c594cb3a291b277ef22..41a9a042e78e2c54173834a6380b426aaec9f16d 100644 (file)
@@ -796,9 +796,8 @@ decode_options (unsigned int argc, const char **argv)
 
   if (optimize_size)
     {
-      /* Inlining of very small functions usually reduces total size.  */
-      set_param_value ("max-inline-insns-single", 5);
-      set_param_value ("max-inline-insns-auto", 5);
+      /* Inlining of functions reducing size is a good idea regardless
+        of them being declared inline.  */
       flag_inline_functions = 1;
 
       /* We want to crossjump as much as possible.  */