This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimal Optimizations: A Very Preliminary Report
- From: Ian Lance Taylor <ian at airs dot com>
- To: gcc at gcc dot gnu dot org
- Date: 12 Aug 2003 14:09:45 -0700
- Subject: Re: Optimal Optimizations: A Very Preliminary Report
- References: <3F383D51.1080202@coyotegulch.com>
Scott Robert Ladd <coyote@coyotegulch.com> writes:
> After testing 10,000 possibilities (selected by breeding 100
> possibilities for 100 generations), gccga identified the following
> command line as the "best":
>
> -O1 -fstrength-reduce -fprefetch-loop-arrays \
> -finline-functions -fgcse -freduce-all-givs
Considering the 18% improvement over -O3, this clearly suggests that
at -O42 gcc should automatically compile code with several different
options and compare the results by running them through a CPU pipeline
simulator. At even higher optimization levels, gcc should actually
run and time the resulting code directly, downloading to a target
board if necessary. And of course at -O1729, gcc should automatically
outsource the RTL code to a human assembly language programmer to get
another sample comparison.
Slightly more seriously, this makes it appear that gcc tends to commit
too soon to a particular approach. At painfully high optimization
levels it would be interesting to maintain a collection of possible
compilations of a piece of code, and only pick one after the final
scheduling pass.
Perhaps compilation is not the data analysis problem I always thought
it was, but is rather more of a directed search problem.
Ian