On Sun, 2007-04-22 at 17:32 -0700, Mark Mitchell wrote: > Steve Ellcey wrote: > >> It came up in a few side conversations. As I understand it, RMS has > >> decreed that the -On optimizations shall be architecture independent. > >> That said, there are "generic" optimizations which really only apply > >> to a single architecture, so there is some precedent for bending this > >> rule. > > > > This seems unfortunate. > > As others have said downthread, I don't think the idea that -O2 should > enable the same set of optimizations on all processors is necessary or > desirable. > > (In fact, there's nothing inherent in even using the same algorithms on > all processors; I can well imagine that the best register allocation > algorithms for x86 and Itanium might be entirely different. I'm in no > way trying to encourage an entire set of per-achitecture optimization > passes; clearly the more we can keep common the better! But, our goal > is to produce a compiler that generates the best possible code on > multiple architectures, not to produce a compiler that uses the same > algorithms and optimization options on all architectures.) > > I have never heard RMS opine on this issue. However, I don't think that > this is something that the SC or FSF need to decide. The SC has made > very clear that it doesn't want to interfere with day-to-day technical > development of the compiler. If the consensus of the maintainers is > that it's OK to turn on some extra optimizations at -O2 on Itanium, then > I think we can just make the change. Of course, if people would prefer > that I ask the SC, I'm happy to do so.
I think it would be nicer if this could be done in a MI way by examining certain target properties. For example, the generic framework might say something like: 'if there's more than N gp registers, enable opt_foo at -O2 or above'. That way we can keep the framework centralized while at the same time allowing bigger systems to exploit useful optimizations with the standard options. I know a number of targets turn off sched1 at -O2 because it simply makes code much worse (due to increased register pressure). We could eliminate much of this machine-dependent tweaking with suitable generic tests. R.