optimize.c (inlinable_function_p): Allow only smaller single functions.
authorKurt Garloff <garloff@suse.de>
Thu, 30 Aug 2001 13:55:17 +0000 (13:55 +0000)
committerGerald Pfeifer <gerald@gcc.gnu.org>
Thu, 30 Aug 2001 13:55:17 +0000 (13:55 +0000)
* optimize.c (inlinable_function_p): Allow only smaller single
functions. Halve inline limit after reaching recursive limit.

From-SVN: r45286

gcc/cp/ChangeLog
gcc/cp/optimize.c

index 5acd064033553aa69069a8de0a19a28bf58531bd..c44c8098546bf27a349dfbfef1b19439905b49cc 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-30  Kurt Garloff  <garloff@suse.de>
+       * optimize.c (inlinable_function_p): Allow only smaller single
+       functions. Halve inline limit after reaching recursive limit.
 2001-08-30  Joern Rennecke <amylaar@redhat.com>
            Jason Merrill  <jason_merrill@redhat.com>
 
index c0ebb99b794a6cb9a5fec646b39ab3d263f22297..95d02b70c340d6f41d9934f6de8ca59d1e95f7d9 100644 (file)
@@ -659,8 +659,9 @@ inlinable_function_p (fn, id)
   /* We can't inline varargs functions.  */
   else if (varargs_function_p (fn))
     ;
-  /* We can't inline functions that are too big.  */
-  else if (DECL_NUM_STMTS (fn) * INSNS_PER_STMT > MAX_INLINE_INSNS)
+  /* We can't inline functions that are too big.
+   * Only allow a single function to eat up half of our budget. */
+  else if (DECL_NUM_STMTS (fn) * INSNS_PER_STMT > MAX_INLINE_INSNS / 2)
     ;
   /* All is well.  We can inline this function.  Traditionally, GCC
      has refused to inline functions using alloca, or functions whose
@@ -674,9 +675,10 @@ inlinable_function_p (fn, id)
 
   /* Even if this function is not itself too big to inline, it might
      be that we've done so much inlining already that we don't want to
-     risk inlining any more.  */
-  if ((DECL_NUM_STMTS (fn) + id->inlined_stmts) * INSNS_PER_STMT 
-      > MAX_INLINE_INSNS)
+     risk too much inlining any more and thus halve the acceptable size. */
+  if ((DECL_NUM_STMTS (fn) + id->inlined_stmts) * INSNS_PER_STMT
+      > MAX_INLINE_INSNS
+      && DECL_NUM_STMTS (fn) * INSNS_PER_STMT > MAX_INLINE_INSNS / 4)
     inlinable = 0;
 
   /* We can inline a template instantiation only if it's fully