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

Chandler Carruth chandlerc at gmail.com
Mon Jan 14 13:23:50 PST 2013


On Mon, Jan 14, 2013 at 4:46 AM, Justin Holewinski <
justin.holewinski at gmail.com> wrote:

> If I understand the attributes correctly, they would be function-level
> attributes applied to IR functions, correct?  I'm curious what the
> semantics would be for cross-function optimization.  For example, consider
> a function "foo" defined with maxopt and a function "bar" defined with
> optsize.  If foo() calls bar() and the inliner wants to inline bar() into
> foo(), is that legal?  If so, that may cause odd effects as you may perform
> expensive optimizations later on the inlined version of bar(), even though
> the original function is marked optsize.
>

This is a great question. My plan would be: inlining doesn't impact the
attributes. The inliner will be free to look at both the caller and the
callee's attributes to choose the best inlining decision.


>
> Also, a nit-pick:  can we make the naming consistent?  It feels a bit
> weird to have maxOPT and OPTsize.  Perhaps use sizeopt and minsizeopt, or
> optmax and optquick?


Meh. I don't care really. It would require changing existing attributes,
but we can do that. I think the most readable structure is the first:

minsizeopt
sizeopt
quickopt
opt
maxopt

I'd like to hear some support for one or the other of these before deciding.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130114/2828bf59/attachment.html>


More information about the cfe-dev mailing list