[llvm-dev] RFC: Safe Whole Program Devirtualization Enablement

Iurii Gribov via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 19 01:27:34 PST 2019

> -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.


More information about the llvm-dev mailing list