pragma(inline, true) errors?

Max Haughton maxhaton at gmail.com
Sat Apr 3 22:22:10 UTC 2021


On Saturday, 3 April 2021 at 20:29:59 UTC, Johan Engelen wrote:
> On Saturday, 3 April 2021 at 12:04:18 UTC, Max Haughton wrote:
>>
>> GCC has a similar set of flags, including 
>> `@attribute("flatten")` which inlines the called functions 
>> rather than the the function in it's caller.
>
> Interesting!
> Is this useful for anyone? We can implement something close to 
> this fairly easily in LDC, but I'd rather wait until this LLVM 
> PR: https://reviews.llvm.org/D70366
>
> -Johan

I've used it maybe once or twice in some synthetic benchmarks - 
I'm not entirely sure, however being able to tune the optimizer 
(particularly the inliner) at source level without extremely ugly 
things like in C++ could be a huge win for the language e.g. the 
backend knows where to spend it's efforts (like in loops), but 
being able to spend more effort on some functions in hot loops is 
provably a win because you can see LLVM and GCC give up inlining 
in some examples on godbolt.


More information about the Digitalmars-d mailing list