<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Mar 26, 2017 at 7:52 AM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> writes:<br>
<br>
> On Fri, Mar 24, 2017 at 2:14 PM, Rafael Avila de Espindola <<br>
> <a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
><br>
>> This has the disadvantage that now two parts of the llvm are responsible<br>
>> for converting dllexport to linker directives (even if they share the<br>
>> function they call).<br>
>><br>
>> I would prefer your previous solution or for the linker to keep a<br>
>> dllexport declaration in the IR.<br>
>><br>
><br>
> That proposal has the disadvantage that it breaks StripFunctionPrototypes<br>
> and GlobalDCE. I thought we covered that in the discussion somewhere.<br>
<br>
</span>I would say it requires StripFunctionPrototypes and GlobalDCE to be<br>
changed.<br>
<br>
Even with this patch we have to change other passes.<br>
<br>
For example, if the inliner inlines the last use of a linkonce_odr, it<br>
has to keep the declaration if it is dllexport.<br></blockquote><div><br></div><div>We're talking about changing the semantics of dllexport on declarations, though, and the inliner can't inline a declaration.</div><div><br></div>In practice, we give all dllexport definitions a non-discardable linkage, so the inliner doesn't normally have to do anything.</div><div class="gmail_quote"><br></div><div class="gmail_quote">What do you think should happen if the user feeds LLVM a discardable dllexport inline function? It doesn't seem reasonable for LLVM to inline the function, delete the body, and leave behind a dllexport declaration that will generate an -export .drective referencing an undefined symbol. Maybe we should consider rejecting exported discardable things in the verifier?</div></div></div>