<div dir="ltr">Hi Artur,<div><br></div><div>Unfortunately, making a visibility analysis at that level would not always give correct results because the symbol information provided by the linker is insufficient to make determinations about which type hierarchies are closed at LTO time. For example, consider a main program with a plugin interface class defined like this:</div><div><br></div><div>struct PluginInterface {</div><div>  virtual void f();</div><div>};</div><div><br></div><div>where plugins in external shared objects implement the plugin interface by deriving from PluginInterface. The problem is that deriving from PluginInterface in a shared object does not necessarily result in a reference to any of the symbols associated with PluginInterface, including its vtable. This would mean that even if plugin shared objects are linked into the main program at link time, LTO may be able to internalize all symbols relating to PluginInterface (and if plugins are dynamically loaded with dlopen(), the linker has absolutely no opportunity to see references to PluginInterface symbols). If we relied only on internalization information, this would cause the analysis to wrongly consider PluginInterface to be closed in the main program.</div><div><br></div><div>Thanks,</div><div>Peter</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 30, 2017 at 1:56 AM, Gainullin, Artur <span dir="ltr"><<a href="mailto:artur.gainullin@intel.com" target="_blank">artur.gainullin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_-5476338338188376947WordSection1">
<p class="MsoNormal">Hi!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have a question about whole program devirtualization pass. According to my understanding devirtualization is performed only for the classes that  have hidden LTO visibility and this visibility is controlled by attributes in the source
 level or command line options. So visibility analysis is currently performed only in the front-end.  But LLVM has LTO internalization pass that  uses information from the linker to mark symbols as internal if it is possible. Have you ever considered to make
 an analysis of visibility at this level (after internalization pass)? Or it is not possible for some reasons?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Best regards, <u></u><u></u></p>
<p class="MsoNormal">Artur Gainullin<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div>