This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] function inlining when optimize for size (PR11830)
- From: Gábor Lóki <loki at inf dot u-szeged dot hu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 17 Mar 2004 09:01:01 +0100
- Subject: [patch] function inlining when optimize for size (PR11830)
Hi,
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?
Regards,
Gábor Lóki
2004-03-17 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
Index: gcc/gcc/opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opts.c,v
retrieving revision 1.61
diff -u -r1.61 opts.c
--- gcc/gcc/opts.c 10 Mar 2004 06:02:53 -0000 1.61
+++ gcc/gcc/opts.c 16 Mar 2004 16:24:29 -0000
@@ -593,6 +593,16 @@
use more short jumps instead of long jumps. */
flag_reorder_blocks = 0;
}
+
+ if (optimize_size)
+ {
+ /* Do the functions 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;