re PR rtl-optimization/10679 ([3.3/3.4] --param min-inline-insns not honoured)
authorMark Mitchell <mark@codesourcery.com>
Wed, 23 Jul 2003 16:45:15 +0000 (16:45 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 23 Jul 2003 16:45:15 +0000 (16:45 +0000)
PR optimization/10679
* tree-inline.c (inlinable_function_p): Honor MIN_INLINE_INSNS.

PR optimization/10679
* g++.dg/opt/inline4.C: New test.

From-SVN: r69710

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/inline4.C [new file with mode: 0644]
gcc/tree-inline.c

index 5c393a878aec7ceaab25f97621552f3c2f2f715e..f1d135696b6b214289492052fb9e53c1f6df6d45 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-23  Mark Mitchell  <mark@codesourcery.com>
+
+       PR optimization/10679
+       * tree-inline.c (inlinable_function_p): Honor MIN_INLINE_INSNS.
+
 2003-07-23  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR target/11607 and PR target/11516
index 1667deac5e0bb0a21d547ef642be81e55e7df465..a87abefa462805b2837fa1eeee3ab8e04aae1557 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-23  Mark Mitchell  <mark@codesourcery.com>
+
+       PR optimization/10679
+       * g++.dg/opt/inline4.C: New test.
+
 2003-07-23  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.dg/parse/crash10: New test.
diff --git a/gcc/testsuite/g++.dg/opt/inline4.C b/gcc/testsuite/g++.dg/opt/inline4.C
new file mode 100644 (file)
index 0000000..2d3eb37
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-options "-O2 -ftemplate-depth-20000 --param min-inline-insns=100 --param max-inline-insns=3" }
+
+template <int I>
+inline void g() { g<I-1>(); return; }
+
+template <>
+inline void g<0>() { int i; return; }
+
+void h() {
+  g<250>();
+}
+
+// { dg-final { scan-assembler-not "_Z1g"  } }
index 3cfe702048e2ac41cd699445cce44b46d1fe0485..4a468a65e9d9a34d9b81d792b0edc60fff6fe496 100644 (file)
@@ -1005,7 +1005,8 @@ inlinable_function_p (tree fn, inline_data *id, int nolimit)
   /* In case we don't disregard the inlining limits and we basically
      can inline this function, investigate further.  */
   if (! (*lang_hooks.tree_inlining.disregard_inline_limits) (fn)
-      && inlinable && !nolimit)
+      && inlinable && !nolimit
+      && currfn_insns > MIN_INLINE_INSNS)
     {
       int sum_insns = (id ? id->inlined_insns : 0) + currfn_insns;
       /* In the extreme case that we have exceeded the recursive inlining
@@ -1017,8 +1018,7 @@ inlinable_function_p (tree fn, inline_data *id, int nolimit)
          with slope -1/MAX_INLINE_SLOPE to exceedingly decrease the
          allowable size. We always allow a size of MIN_INLINE_INSNS
          though.  */
-      else if ((sum_insns > MAX_INLINE_INSNS)
-              && (currfn_insns > MIN_INLINE_INSNS))
+      else if (sum_insns > MAX_INLINE_INSNS)
        {
          int max_curr = MAX_INLINE_INSNS_SINGLE
                        - (sum_insns - MAX_INLINE_INSNS) / MAX_INLINE_SLOPE;