[llvm-dev] RFC: Safe Whole Program Devirtualization Enablement
Teresa Johnson via llvm-dev
llvm-dev at lists.llvm.org
Thu Dec 19 06:54:59 PST 2019
On Thu, Dec 19, 2019 at 1:27 AM Iurii Gribov <Iurii.Gribov at ceva-dsp.com>
> > -fsemantic-interposition controls whether the compiler may assume that
> symbols are not interposed,
> > and it has nothing to do with the optimization proposed here.
> Thanks Peter, you are probably right. I've overestimated the information
> that's available to LTO optimizer at link time.
> Leaving shared libraries aside, one might argue that when LTOptimizing
> main executable file compiler/linker is aware of all participating
> libraries and so can decide whether class is not derived from and apply
> devirtualization based on that information (assuming that run-time library
> implementations or dlopen calls do not introduce new inherited classes at
> runtime, that's where -fno-semantic-interposition assumption comes into
> play). But the "decide whether class is not derived from" part here is
> problematic - derived classes in libraries may have hidden visibility and
> will go undetected.
Right, this is why we need some guarantee from the user that the LTO link
will see all derived classes. Currently at head the only way to do so is
via -fvisibility=hidden when compiling to bitcode. This proposal adds
another mechanism, pre-enabling the bitcode for WPD and delaying the
guarantee until LTO link time with an option there.
Teresa Johnson | Software Engineer | tejohnson at google.com |
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev