aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2021-02-16 19:44:58 -0800
committerTeresa Johnson <tejohnson@google.com>2021-02-19 12:42:34 -0800
commit0923a60ea70f884d2f170f65d0faa494a25af231 (patch)
tree0a29b0cfcc6a3c08c5f86da6070bf80b622e6064 /llvm/lib/IR/ConstantFold.cpp
parentefc8f3311b57ce438500d8a0908e6c7cf6c9f551 (diff)
downloadllvm-0923a60ea70f884d2f170f65d0faa494a25af231.zip
llvm-0923a60ea70f884d2f170f65d0faa494a25af231.tar.gz
llvm-0923a60ea70f884d2f170f65d0faa494a25af231.tar.bz2
[clang] Emit type metadata on available_externally vtables for WPD
When WPD is enabled, via WholeProgramVTables, emit type metadata for available_externally vtables. Additionally, add the vtables to the llvm.compiler.used global so that they are not prematurely eliminated (before *LTO analysis). This is needed to avoid devirtualizing calls to a function overriding a class defined in a header file but with a strong definition in a shared library. Without type metadata on the available_externally vtables from the header, the WPD analysis never sees what a derived class is overriding. Even if the available_externally base class functions are pure virtual, because shared library definitions are already treated conservatively (committed patches D91583, D96721, and D96722) we will not devirtualize, which would be unsafe since the library might contain overrides that aren't visible to the LTO unit. An example is std::error_category, which is overridden in LLVM and causing failures after a self build with WPD enabled, because libstdc++ contains hidden overrides of the virtual base class methods. Differential Revision: https://reviews.llvm.org/D96919
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
0 files changed, 0 insertions, 0 deletions