This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] function inlining when optimize for size (PR11830)
- From: gkeating at apple dot com (Geoffrey Keating)
- To: gcc-patches at gcc dot gnu dot org, Gabor Loki <loki at inf dot u-szeged dot hu>
- Date: Fri, 2 Apr 2004 14:17:18 -0800 (PST)
- Subject: Re: [patch] function inlining when optimize for size (PR11830)
- References: <406BBA9F.5080302@inf.u-szeged.hu>
I eventually committed this patch. It's the same except I decided
that it was pretty clear from the context what the code did, but not
why, so I changed the comment.
I bootstrapped & tested on powerpc-darwin. There was one extra pass,
-FAIL: gcc.c-torture/execute/pure-1.c compilation, -Os
presumably because now -Os inlined some routine or other to suppress
the failure.
--
- Geoffrey Keating <geoffk@apple.com>
===File ~/patches/loki-Osinline.patch=======================
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.3333
diff -u -p -u -p -r2.3333 ChangeLog
--- ChangeLog 2 Apr 2004 15:05:10 -0000 2.3333
+++ ChangeLog 2 Apr 2004 22:13:53 -0000
@@ -1,3 +1,8 @@
+2004-04-02 Gabor Loki <loki@inf.u-szeged.hu>
+
+ * opts.c (decode_options): Do function inlining with very small
+ max-inline-insns-* parameters when optimizing for size.
+
2004-04-02 Vladimir Makarov <vmakarov@redhat.com>
* config/i386/i386.h (TARGET_NOCONA): New macro.
Index: opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opts.c,v
retrieving revision 1.62
diff -u -p -u -p -r1.62 opts.c
--- opts.c 14 Mar 2004 22:26:06 -0000 1.62
+++ opts.c 2 Apr 2004 22:13:53 -0000
@@ -594,6 +594,15 @@ decode_options (unsigned int argc, const
flag_reorder_blocks = 0;
}
+ 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);
+ set_param_value ("max-inline-insns-rtl", 10);
+ flag_inline_functions = 1;
+ }
+
/* Initialize whether `char' is signed. */
flag_signed_char = DEFAULT_SIGNED_CHAR;
/* Initialize how much space enums occupy, by default. */
============================================================