[LLVMdev] inlining hint

Devang Patel devang.patel at gmail.com
Wed Aug 26 12:01:25 PDT 2009


On Wed, Aug 26, 2009 at 11:58 AM, Dale Johannesen<dalej at apple.com> wrote:
>
> On Aug 26, 2009, at 11:54 AMPDT, Devang Patel wrote:
>
>> On Wed, Aug 26, 2009 at 10:59 AM, Dale Johannesen<dalej at apple.com> wrote:
>>>
>>> You may have noticed I added an "inlinehint" attribute to the IR
>>> yesterday, to represent user declarations that hint inlining would be
>>> a good idea ("inline" keyword).  Chris and I have been discussing how
>>> to hook it up to the C++ FE.  Consider:
>>>
>>> class X {
>>>   int A(int x) {....}
>>>   inline int B(int x);
>>> };
>>> inline int X::B(int x) {...}
>>>
>>> Per the language standard, A and B are semantically identical, both
>>> "inline".  It's been suggested that we should omit the inlinehint on
>>> A, on the grounds that many C++ programmers do not know this, and
>>> therefore misuse the construct.   I want to get some other views on
>>> this.  Do you think it's a good idea?
>>> (For those of you who consider yourselves C++ programmers - and not FE
>>> language lawyers, who are supposed to know what the standard says -
>>> did you know this?)
>>
>> I do not understand how the "inlinehint" will help.  How will it
>> influence the inliner ?
>
> The hint should make it more attractive to inline.  I don't know the details
> yet and they will require some experimenting.
>

In that case you want to add hint to A also. AFAIU, attractiveness of
A and B should match and inliner won't know whether the function body
is inside the class definition or not.
-
Devang




More information about the llvm-dev mailing list