From 3684a055a057aac41755fb491c3e7811fc9d2be8 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 26 Mar 2003 14:53:37 -0800 Subject: [PATCH] c-decl.c (finish_function): Always defer if DECL_DECLARED_INLINE_P. * c-decl.c (finish_function): Always defer if DECL_DECLARED_INLINE_P. * gcc.dg/inline-4.c: New. From-SVN: r64906 --- gcc/ChangeLog | 4 ++++ gcc/c-decl.c | 9 +++++++-- gcc/testsuite/gcc.dg/inline-4.c | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/inline-4.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6aba36fde21..676400029bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2003-03-26 Richard Henderson + + * c-decl.c (finish_function): Always defer if DECL_DECLARED_INLINE_P. + 2003-03-26 Roger Sayle PR bootstrap/10051, PR bootstrap/10169. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 52b42a18c06..d52823bde97 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6460,8 +6460,13 @@ finish_function (nested, can_defer_p) function completely. */ timevar_push (TV_INTEGRATION); uninlinable = ! tree_inlinable_function_p (fndecl, 0); - - if (! uninlinable && can_defer_p + + if (can_defer_p + /* We defer functions marked inline *even if* the function + itself is not inlinable. This is because we don't yet + know if the function will actually be used; we may be + able to avoid emitting it entirely. */ + && (! uninlinable || DECL_DECLARED_INLINE_P (fndecl)) /* Save function tree for inlining. Should return 0 if the language does not support function deferring or the function could not be deferred. */ diff --git a/gcc/testsuite/gcc.dg/inline-4.c b/gcc/testsuite/gcc.dg/inline-4.c new file mode 100644 index 00000000000..2442f2d392d --- /dev/null +++ b/gcc/testsuite/gcc.dg/inline-4.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-final { scan-assembler-not "big_static_inline" } } */ + +extern void f(void); +static inline void big_static_inline(void) +{ + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); + f(); f(); f(); f(); f(); f(); f(); f(); f(); f(); +} -- 2.30.2