<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 19, 2015 at 8:15 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Sat, Sep 19, 2015 at 6:15 PM, David Blaikie via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="font-size:12.8px">I was just thinking through the possible advice of encouraging users to use explicit template instantiation declarations/definitions to reduce object size.</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">It seems this may hurt performance in non-LTO builds by causing what were inlinable functions to no longer be available for inlining.</span><br style="font-size:12.8px"><br style="font-size:12.8px"><span style="font-size:12.8px">Should we consider emitting available_externally definitions of such entities (possibly under specific/higher optimization levels)?</span></div></blockquote><div><br></div></span><div>We should, and we already do: <a href="http://goo.gl/V8G5kU" target="_blank">http://goo.gl/V8G5kU</a></div><div><br></div><div>Do you have a case where we fail to do so? It's possible there's a bug in this determination.</div></div></div></div></blockquote><div><br>Sorry, yes, should've included my test case, which boiled down to:<br><br><pre style="color:rgb(0,0,0)">template <typename T> void f() {}
extern template void f<int>();
<span style="font-family:monospace,monospace">void g() { f<int>(); }</span><span style="font-family:monospace,monospace;color:rgb(34,34,34)"> </span></pre></div></div>The difference being the absence of the "inline" keyword on f's definition. I wonder if that's the right tradeoff (I can understand using the inline keyword to hint the inliner a little more strongly - but this seems like a much stronger dependence on the keyword than I'd expect). Perhaps it is.<br><br>- Dave</div></div>