From 11b8e71cec8c06d103ec4acc344a99c729f3adcd Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 23 Jul 2003 16:45:15 +0000 Subject: [PATCH] re PR rtl-optimization/10679 ([3.3/3.4] --param min-inline-insns not honoured) 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 | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/opt/inline4.C | 13 +++++++++++++ gcc/tree-inline.c | 6 +++--- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/inline4.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c393a878ae..f1d135696b6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-07-23 Mark Mitchell + + PR optimization/10679 + * tree-inline.c (inlinable_function_p): Honor MIN_INLINE_INSNS. + 2003-07-23 John David Anglin PR target/11607 and PR target/11516 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1667deac5e0..a87abefa462 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-07-23 Mark Mitchell + + PR optimization/10679 + * g++.dg/opt/inline4.C: New test. + 2003-07-23 Nathan Sidwell * 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 index 00000000000..2d3eb379648 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/inline4.C @@ -0,0 +1,13 @@ +// { dg-options "-O2 -ftemplate-depth-20000 --param min-inline-insns=100 --param max-inline-insns=3" } + +template +inline void g() { g(); return; } + +template <> +inline void g<0>() { int i; return; } + +void h() { + g<250>(); +} + +// { dg-final { scan-assembler-not "_Z1g" } } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 3cfe702048e..4a468a65e9d 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -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;