From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17294 invoked by alias); 20 Dec 2002 06:13:06 -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 17280 invoked from network); 20 Dec 2002 06:13:03 -0000 Received: from unknown (HELO pimout3-ext.prodigy.net) (207.115.63.102) by 209.249.29.67 with SMTP; 20 Dec 2002 06:13:03 -0000 Received: from wobble.local (adsl-64-173-27-188.dsl.sntc01.pacbell.net [64.173.27.188]) by pimout3-ext.prodigy.net (8.12.3 da nor stuldap/8.12.3) with ESMTP id gBK6CpkD628632 for ; Fri, 20 Dec 2002 01:12:51 -0500 Received: (from martin@localhost) by wobble.local (8.11.6/8.11.6) id gBK6Cop05085; Thu, 19 Dec 2002 22:12:50 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15874.46305.491247.297301@wobble.local> Date: Fri, 20 Dec 2002 03:44:00 -0000 From: Martin Buchholz To: gcc@gcc.gnu.org Subject: Optimization advice for maintainers: go for low-hanging fruit Reply-To: martin@xemacs.org X-SW-Source: 2002-12/txt/msg01250.txt.bz2 I've been staring at a lot of g++-generated x86 assembler, trying to coax g++ into creating better code, and creating a bunch of optimization-related PRs. Overall, I'm disappointed by gcc's ability to optimize some very simple things like constant-folding. The most distressing thing about the failures is that gcc is invariably capable of performing all the optimizations I care about, just not consistently. Seemingly irrelevant random features of the source code seem to inhibit optimizations from being performed. My suggestion for improving gcc's object code is not to add ever more clever optimization passes, but simply to concentrate on making sure that existing optimizations are applied everywhere they can be - not a sexy job, certainly, but very likely low-hanging fruit. My guess is that past maintainers, in a hurry to fix code generation bugs, have fixed bugs "the wrong way" and thus disabled optimizations in some paths through the code. c++/8936: Declaration of never defined member function changes generated code optimization/8952: failure to optimize away trivial C++ object creation optimization/8967: Making class data members `const' pessimizes code optimization/9016: Failure to consistently constant fold "constant" C++ objects Martin