RFC: #pragma optimization_level

Marcin Dalecki martin@dalecki.de
Sat Apr 2 00:56:00 GMT 2005


On 2005-04-01, at 23:17, Richard Guenther wrote:

> On Apr 1, 2005 11:07 PM, Mark Mitchell <mark@codesourcery.com> wrote:
>> Dale Johannesen wrote:
>>> Agree.  (And documentation will be written.)
>>
>> Yay.  It sounds like we're definitely on the same page.  I think that 
>> as
>> long as we keep the semantics clear, this will be useful 
>> functionality.
>>
>>>> That's what I assumed.  Anything finer than that is insane. :-)
>>>
>>>
>>> Actually there are cases where it makes sense:  you could ask that a
>>> particular call be
>>> inlined, or a particular loop be unrolled N times.
>>
>> True.  Consider my remark regarding insanity qualified to 
>> whole-function
>> optimizations. :-)
>
> But the question is, do we want all this sort of #pragmas?  It would
> surely better to improve the compilers decisions on applying certain
> optimizations.  As usual, in most of the cases the compiler will be
> smarter than the user trying to override it (and hereby maybe only
> working around bugs in a particular compiler release).

Compilers are good. But they still don't think. And they don't have a 
clue
about the input characteristics and thus affected runtime behavior of 
the code.

Sometimes you  definitively want to switch the optimizers GOALS
at the level of a single file. Or in other words: you want to provide
additional information about the runtime of the code to the compiler for
better optimization decisions.

Like for example optimizing the whole system for size but letting him
optimize some well identified hot-spot functions for speed.



More information about the Gcc mailing list