From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7347 invoked by alias); 23 Apr 2002 02:05:10 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 7269 invoked from network); 23 Apr 2002 02:05:09 -0000 Received: from unknown (HELO pinskia.dyndns.org) (66.161.185.64) by sources.redhat.com with SMTP; 23 Apr 2002 02:05:09 -0000 Received: from zhivago.i.pinski.fam (IDENT:root@localhost.pinski.fam [127.0.0.1]) by pinskia.dyndns.org (8.12.1/8.12.1) with ESMTP id g3N254op032640; Mon, 22 Apr 2002 22:05:05 -0400 (EDT) Date: Mon, 22 Apr 2002 19:25:00 -0000 Subject: Re: GCC performance regression - up to 20% ? Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v481) Cc: gcc@gcc.gnu.org To: Carlo Wood From: Andrew Pinski In-Reply-To: <20020423032032.A31123@alinoe.com> Message-Id: <9D7EA124-565E-11D6-B762-000393122612@physics.uc.edu> Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg01134.txt.bz2 On Monday, April 22, 2002, at 09:20 , Carlo Wood wrote: > On Mon, Apr 22, 2002 at 08:49:20PM -0400, Andrew Pinski wrote: >> And it was -O3 that included the inline optimization. > > Huh?? > I am using the fact (I hope) that functions marked with 'inline' > or member functions that are defined inside their class declaration > are inlined already with -O. > Talking about real small functions here (accessors etc). > Read the manual, under the -O3 option: Optimize yet more. `-O3' turns on all optimizations specified by `-O2' and also turns on the `-finline-functions' and `-frename-registers' options. These options control various sorts of optimizations: -O -O1 Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. Without `-O', the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you would expect from the source code. Without `-O', the compiler only allocates variables declared register in registers. The resulting compiled code is a little worse than produced by PCC without `-O'. With `-O', the compiler tries to reduce code size and execution time. When you specify `-O', the compiler turns on `-fthread-jumps' and `-fdefer-pop' on all machines. The compiler turns on `-fdelayed-branch' on machines that have delay slots, and `-fomit-frame-pointer' on machines that can support debugging even without a frame pointer. On some machines the compiler also turns on other flags. -O2 Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. The compiler does not perform loop unrolling or function inlining when you specify `-O2'. As compared to `-O', this option increases both compilation time and the performance of the generated code. `-O2' turns on all optional optimizations except for loop unrolling, function inlining, and register renaming. It also turns on the `-fforce-mem' option on all machines and frame pointer elimination on machines where doing so does not interfere with debugging. Please note the warning under `-fgcse' about invoking `-O2' on programs that use computed gotos. -O3 Optimize yet more. `-O3' turns on all optimizations specified by `-O2' and also turns on the `-finline-functions' and `-frename-registers' options. -O0 Do not optimize. -Os Optimize for size. `-Os' enables all `-O2' optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size. If you use multiple `-O' options, with or without level numbers, the last such option is the one that is effective. > -- > Carlo Wood > >