[PATCH] D18918: [DebugInfo] Try to make class memory layout more efficient
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 9 07:54:40 PDT 2016
DIBuilder and/or the constructors should be enforcing the limits on the non-enums like Args (and probably also the enums).
-- adrian
> On Apr 8, 2016, at 11:11 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
> Certainly seems like a thing we might want to try - though it'd help to have a reminder/description of why shrinking these fields to these specific bit sizes is valid (are the already restricted to those sizes in other places/ways, for example - point to where/how they're already so restricted)
>
> On Fri, Apr 8, 2016 at 7:08 PM, Davide Italiano via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> davide created this revision.
> davide added reviewers: dexonsmith, aprantl, echristo, dblaikie.
> davide added a subscriber: llvm-commits.
>
> I started this effort after noticing that DI shows up as a considerable portion of memory usage during an LTO build (of clang, and others).
> This is roughly the data I got (peak usage):
> DISubprogram: 228MB
> DILocalVariable: 164MB
> The proposed patch packs field slightly more efficiently reducing the size of DISubprogram from 48bytes to 40bytes and of DILocalVariable from 40 bytes to 32 bytes.
> The saving overall in memory is ~70MB.
> This is still to be considered WIP as this breaks 4 tests in the LLVM suite (which I'm currently investigating), but I wanted to have some eyes on it as DebugInfo seems to be of interest of many these days.
>
> http://reviews.llvm.org/D18918 <http://reviews.llvm.org/D18918>
>
> Files:
> include/llvm/IR/DebugInfoMetadata.h
>
> Index: include/llvm/IR/DebugInfoMetadata.h
> ===================================================================
> --- include/llvm/IR/DebugInfoMetadata.h
> +++ include/llvm/IR/DebugInfoMetadata.h
> @@ -1229,21 +1229,21 @@
>
> unsigned Line;
> unsigned ScopeLine;
> - unsigned Virtuality;
> unsigned VirtualIndex;
> - unsigned Flags;
> - bool IsLocalToUnit;
> - bool IsDefinition;
> - bool IsOptimized;
> + unsigned Virtuality:2;
> + unsigned Flags:27;
> + bool IsLocalToUnit:1;
> + bool IsDefinition:1;
> + bool IsOptimized:1;
>
> DISubprogram(LLVMContext &C, StorageType Storage, unsigned Line,
> - unsigned ScopeLine, unsigned Virtuality, unsigned VirtualIndex,
> + unsigned ScopeLine, unsigned VirtualIndex, unsigned Virtuality,
> unsigned Flags, bool IsLocalToUnit, bool IsDefinition,
> bool IsOptimized, ArrayRef<Metadata *> Ops)
> : DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram,
> Ops),
> - Line(Line), ScopeLine(ScopeLine), Virtuality(Virtuality),
> - VirtualIndex(VirtualIndex), Flags(Flags), IsLocalToUnit(IsLocalToUnit),
> + Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
> + Virtuality(Virtuality), Flags(Flags), IsLocalToUnit(IsLocalToUnit),
> IsDefinition(IsDefinition), IsOptimized(IsOptimized) {}
> ~DISubprogram() = default;
>
> @@ -1858,8 +1858,8 @@
> friend class LLVMContextImpl;
> friend class MDNode;
>
> - unsigned Arg;
> - unsigned Flags;
> + unsigned Arg:16;
> + unsigned Flags:16;
>
> DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
> unsigned Arg, unsigned Flags, ArrayRef<Metadata *> Ops)
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160409/e1494c6d/attachment.html>
More information about the llvm-commits
mailing list