[cfe-dev] always_inline and noinline attributes

Chris Lattner clattner at apple.com
Wed Jul 23 23:54:17 PDT 2008


On Jul 23, 2008, at 11:47 PM, Matthijs Kooijman wrote:

> Hi Chris,
>
>> I think that Chris is really in favour of option b) here, because  
>> "inlining
>> can sometimes change semantics". However, I still don't really  
>> understand what
>> kind of cases we are talking about. Chris, could you give an  
>> example? Also, is
>> this changing of semantics specific to always_inline? From what you  
>> wrote, I
>> would assume that this changing of semantics can happen with any  
>> inline, so
>> you shouldn't be doing any inlining at all at link time. Nor at  
>> optimization
>> time, for that matter, so I'm probably missing an essential point  
>> here :-)
> I did mean in favour of option a) here, actually :-)

I haven't been following the full thread, but Matthijs asked me to  
opine :).

I think there are two equally reasonable approaches:

1) always_inline only affects the "front-end inliner" and gets  
stripped out by that inliner.  This means it would not survive to LTO  
(if run).  This would be extremely compatible with GCC.

2) always_inline persists in the IR and any inliner pass would inline  
any direct calls to always_inline functions whenever possible.

I don't have a strong opinion on which approach is taken,

-Chris



More information about the cfe-dev mailing list