diff options
author | David Green <david.green@arm.com> | 2018-09-12 14:09:06 +0000 |
---|---|---|
committer | David Green <david.green@arm.com> | 2018-09-12 14:09:06 +0000 |
commit | be0c5b6d3c415ae2b778c7c641e3f451652718f7 (patch) | |
tree | c630557d436e909d11b8db527cad760319ee1d2c /clang/lib/CodeGen/MicrosoftCXXABI.cpp | |
parent | a34679658f881a6751651e0891b08af44b48fe69 (diff) | |
download | bcm5719-llvm-be0c5b6d3c415ae2b778c7c641e3f451652718f7.tar.gz bcm5719-llvm-be0c5b6d3c415ae2b778c7c641e3f451652718f7.zip |
[CodeGen] Align rtti and vtable data
Previously the alignment on the newly created rtti/typeinfo data was largely
not set, meaning that DataLayout::getPreferredAlignment was free to overalign
it to 16 bytes. This causes unnecessary code bloat.
Differential Revision: https://reviews.llvm.org/D51416
llvm-svn: 342053
Diffstat (limited to 'clang/lib/CodeGen/MicrosoftCXXABI.cpp')
-rw-r--r-- | clang/lib/CodeGen/MicrosoftCXXABI.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index 968c171c71b..3b894fcdc15 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp @@ -2024,8 +2024,10 @@ MicrosoftCXXABI::getAddrOfVBTable(const VPtrInfo &VBT, const CXXRecordDecl *RD, assert(!CGM.getModule().getNamedGlobal(Name) && "vbtable with this name already exists: mangling bug?"); - llvm::GlobalVariable *GV = - CGM.CreateOrReplaceCXXRuntimeVariable(Name, VBTableType, Linkage); + CharUnits Alignment = + CGM.getContext().getTypeAlignInChars(CGM.getContext().IntTy); + llvm::GlobalVariable *GV = CGM.CreateOrReplaceCXXRuntimeVariable( + Name, VBTableType, Linkage, Alignment.getQuantity()); GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global); if (RD->hasAttr<DLLImportAttr>()) |