[cfe-dev] [RFC] add Function Attribute to disable optimization

Jeffrey Walton noloader at gmail.com
Mon Jun 17 11:12:53 PDT 2013


On Mon, Jun 17, 2013 at 1:59 PM, jahanian <fjahanian at apple.com> wrote:
> Wouldn’t implementing this proposal be a red herring? By this I mean, it is
> possible that
> throughout the optimization phases, there is an implied assumption that all
> functions
> are similarly optimized. An example would be under certain optimization
> flag, compiler changes
> calling convention of static functions.
Forgive my ignorance, but aren't all functions in the compilation unit
optimized at the same level? It does not matter if its a user supplied
command line or a makefile recipe.

Jeff

> On Jun 17, 2013, at 8:58 AM, Andrea_DiBiagio at sn.scee.net wrote:
>
> Hi,
>
> I previously made a proposal for adding a pragma for per-function
> optimization level control due to a number of requests from our customers
> (See http://comments.gmane.org/gmane.comp.compilers.clang.devel/28958 for
> the previous discussion), however the discussion was inconclusive.  Some
> of my colleagues recently had the opportunity to discuss the proposal with
> a number of people at and before the recent Bay Area social where it was
> generally agreed that we should resubmit a new scaled-down proposal that
> still addresses our users' primary use-case without introducing the
> complexity of full per-function optimization level control at this time.
>
> This proposal is to create a new function-level attribute which would tell
> the compiler to not to perform any optimizing transformations on the
> specified function.
>
> The use-case is to be able to selectively disable optimizations when
> debugging a small number of functions in a compilation unit to provide an
> -O0-like quality of debugging in cases where compiling the whole unit at
> anything less than full optimization would make the program run too
> slowly.  A useful secondary-effect of this feature would be to allow users
> to temporarily work-around optimization bugs in LLVM without having to
> reduce the optimization level for the whole compilation unit, however we
> do not consider this the most important use-case.
>
> ...




More information about the cfe-dev mailing list