[cfe-dev] Inlining dllimport functions

Sohail Somani (Fizz Buzz Inc.) via cfe-dev cfe-dev at lists.llvm.org
Thu Sep 13 08:44:57 PDT 2018


On Thu, Sep 13, 2018, at 11:43 AM, Hamza Sood via cfe-dev wrote:
> Currently, Clang won’t inline a dllimport function that references a 
> non-dllimport function. This has a big performance impact on using libc+
> + on Windows because even something as simple as vector::data() won’t be 
> inlined at the max optimisation level.
> 
> Would anything break if Clang were to allow inlining of a dllimport 
> function that references a non-dllimport function that’s also declared 
> inline?
> 
> E.g:
> 
> inline bool f() { return false; }
> 
> __declspec(dllimport) inline bool g() { return f(); }
> 
> bool h() {
>   // can we inline this without issue?
>   return g();
> }

I've had to do this locally for similar reasons, and so far so good.



More information about the cfe-dev mailing list