[llvm-dev] RFC: Safe Whole Program Devirtualization Enablement
Iurii Gribov via llvm-dev
llvm-dev at lists.llvm.org
Wed Dec 18 03:37:56 PST 2019
> Are you suggesting that we should be more aggressive by default (i.e. without -fvisibility=hidden or any new options)?
> I believe that will be too aggressive for class LTO visibility.
> It is common to override a virtual functions across shared library boundaries
I'm myself a fan of GCC's conservative approach so I'd agree with you on that. But regardless of my personal opinions, LLVM already optimizes normal functions in shared libraries (thus mercilessly breaking overrides via LD_PRELOAD, etc.) and I don't see how virtual functions are any different. I think default LLVM behavior needs to be consistent for all inter-procedural optimizations (be it inlining, devirtualization or cloning).
Maybe it's time to resurrect Hal's -fsemantic-interposition flag and use it consistently throughout compiler? Users who need GCC-like semantics will be able to employ this flag to prevent unsafe optimizations.
More information about the llvm-dev