[LLVMdev] [cfe-dev] RFC: Codifying (but not formalizing) the optimization levels in LLVM and Clang

Krzysztof Parzyszek
Mon, 14 Jan 2013 23:22:30 -0000

On 1/14/2013 4:57 PM, Chandler Carruth wrote:
>
> I absolutely think that when a function has an optimization attribute,
> that applies to the code in the function and all code inlined into the
> function. If foo calls bar then foo's optimization level should be
valid
> for bar, or bar should be marked noinline, or something else.

That's going way too far.

For example, if a function foo, which can be compiled with -ffast-math
calls bar, which contains code that would be "over optimized" with
-ffast-math, then you cannot inline bar into foo, but you can inline it
in any other function that does is compiled with the same options as bar.


> I'm dubious about any kind of built-in way of controlling this because
> there shouldn't (in a perfect world) be any code which "isn't
valid" at
> one optimization level,

Should we wait until you see such situations then?  ;)

-Krzysztof


--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation