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: Gábor Lóki <loki at inf dot u-szeged dot hu>
- To: Geoff Keating <geoffk at geoffk dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 01 Apr 2004 08:45:51 +0200
- Subject: Re: [patch] function inlining when optimize for size (PR11830)
- References: <405805BD.8060500@inf.u-szeged.hu> <jm1xn84edl.fsf@desire.geoffk.org>
Geoff Keating wrote:
Gábor Lóki <loki@inf.u-szeged.hu> writes:
I have examined if it is possible to use the function inlining when
optimizing for size. I've found we can use it without any risk because
when the max-inline-insns-* parameters were set with a small value
the function inlining doesn't inline large functions.
It is also fix the PR11830 (http://gcc.gnu.org/PR11830).
I measuerd the size effect on CSiBE and this patch made about 1% code
size save (arm:1.212%, i386:1.024%, i686:1.029%, m68k:0.795%,
mips:1.096%, ppc:1.106%).
Bootstrapped and regtested on i686-pc-linux-gnu and regtested also on
{arm,mips,ppc}-elf with no new failures.
Is it OK for mainline?
This is OK, except:
+ /* Do the functions inlining with very small max-inline-insns-*.
This would be better written "Do function inlining". With that
change, please check it in.
Typo fixed.
I don't yet have CVS write access. Please could you commit this
patch for me. Thanks very much in advance.
Regards,
Gábor Lóki
Index: gcc/gcc/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.3322
diff -u -r2.3322 ChangeLog
--- gcc/gcc/ChangeLog 1 Apr 2004 03:50:23 -0000 2.3322
+++ gcc/gcc/ChangeLog 1 Apr 2004 06:22:50 -0000
@@ -1,3 +1,8 @@
+2004-04-01 Gábor Lóki <loki@inf.u-szeged.hu>
+
+ * opts.c (decode_options): Do function inlining with very small
+ max-inline-insns-* parameters when optimizing for size
+
2004-03-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* builtins.c, c-aux-info.c, c-common.c, c-cppbuiltin.c, c-decl.c:
Index: gcc/gcc/opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opts.c,v
retrieving revision 1.62
diff -u -r1.62 opts.c
--- gcc/gcc/opts.c 14 Mar 2004 22:26:06 -0000 1.62
+++ gcc/gcc/opts.c 1 Apr 2004 06:23:13 -0000
@@ -594,6 +594,16 @@
flag_reorder_blocks = 0;
}
+ if (optimize_size)
+ {
+ /* Do function inlining with very small max-inline-insns-*.
+ handle_options could overwrite if it's necessary. */
+ 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. */