This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for linux 2.1.127


In article <m0zcaVi-000393C@ocean.lucon.org>,
hjl@lucon.org (H.J. Lu) writes:
> Hi,
> Here is a patch for Linux 2.1.127. Now I am running Linux 2.1.127
> compiled with egcs 1.1.1 prerelease using -O6.

It is not a good idea to compile the kernel with -O6. -O6 includes
-finline-functions, and automatic inlining messes up a lot of fast
paths (mainly because egcs is not able to do register life splitting
yet)

e.g. this is a common idiom in the kernel:

static int __do_something(void)
{
	/* do something slow that needs lots of registers */ 
}

static inline int do_something(void)
{
	if (something needed) 
		__do_something();
} 

In case the slow part is only seldom needed this generates very good 
code because in the common path there is no function call and the calling
function has the complete register set for their own use (important on x86).
Now when you use -O6 the compiler will inline the slow path and increase the
number of variables that need to be fit into the same register significantly,
which gives much slower code.  Also it has bad effects on the L1 
cache. Nearly all functions where it pays to inline them are already 
explicitely marked inline.

So just use -O2 instead of -O6.

-Andi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]