From 003b6033e1b254dd96ddb341f375b73ee5bed2af Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Thu, 29 Sep 2022 21:53:30 +0000 Subject: [clang] Ensure correct metadata for relative vtables Prior to this, metadata pertaining to the size or address point offsets into a relative vtable were twice the value they should be (treating component widths as pointer width rather than 4 bytes). This prevented some vtables from being devirtualized with D134320. This ensures the correct metadata is written so whole program devirtualization can catch these remaining devirt targets. Differential Revision: https://reviews.llvm.org/D134687 --- clang/lib/CodeGen/CodeGenModule.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.h') diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 5289f0cc1355..4595dd55401d 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -760,6 +760,10 @@ public: return VTables.getItaniumVTableContext(); } + const ItaniumVTableContext &getItaniumVTableContext() const { + return VTables.getItaniumVTableContext(); + } + MicrosoftVTableContext &getMicrosoftVTableContext() { return VTables.getMicrosoftVTableContext(); } @@ -1444,6 +1448,8 @@ public: llvm::GlobalVariable *VTable, const VTableLayout &VTLayout); + llvm::Type *getVTableComponentType() const; + /// Generate a cross-DSO type identifier for MD. llvm::ConstantInt *CreateCrossDsoCfiTypeId(llvm::Metadata *MD); -- cgit v1.2.3