Skip to contentSkip to conversation

-O3.... again

DISCUSSION Timothy Miller 2 participants 2 messages Mar 16, 2004

lore
Share & tools
lore
#0 lore raw

I know this has been beat to death, but I was wondering about something, and google isn't being forthcoming.

I understand that the biggest problem with -O3 is the automatic function inlining. It tends to make things worse, due to cache misses.

Well, the default maximum for automatic inlining for GCC (--param max-inline-insns-auto=n) is 300 pseudo instructions, which sounds awfully high to me (although I don't know what a pseudo instruction quite corresponds to).

Has anyone tinkered with different values for -finline-limit, or specifically max-inline-insns-auto to see if they could actually get any benefit out of it?

It seems to me that as a function grows beyond a certain size, the value of inlining it diminishes rapidly. Only when the function-call overhead is a significant part of the over-all run-time of the rest of the function does it really help to inline. Well, if the kernel isn't getting benefit from the defaults for -O3, then perhaps the defaults are wrong and need to be tweaked.

Anyone experiment with this? Any thoughts?

I doubt this would apply well right off to the kernel, but right now, I'm doing gentoo emerges of GCC with varying CFLAGS settings. First, I emerge GCC with the experimental values of CFLAGS. Then I change the CFLAGS to a standard setting and time it (the timed run must always have the same parameters for the target). My objective is to determine the MINIMUM value of max-inline-insns-auto which yields an improvement over -O2.

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 1 line · you

Anyone experiment with this? Any thoughts?

Some time ago I experimented with some crazy (tm)
optimization values.
http://marc.theaimsgroup.com/?l=linux-kernel&m=104655063413152&w=2

As you can see -O3 broke ide-scsi for me. I don't know the reason for it and I don't know if this applies to recent kernels, too.

So it is possible to break stuff with -O3

- --
Regards Michael Buesch [ http://www.tuxsoft.de.vu ]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAVy2rFGK1OIvVOP4RAm9mAJ9zK3OiDsJmUXaaEygxikR034Rv9ACfXlaB cAQ/IoX7wzxUNaOB+1LtYxE=
=0inF
-----END PGP SIGNATURE-----