OSDN Git Service

[DebugInfo] Reduce size of DILocalVariable from 40 to 32 bytes.
authorDavide Italiano <davide@freebsd.org>
Sat, 16 Apr 2016 02:27:56 +0000 (02:27 +0000)
committerDavide Italiano <davide@freebsd.org>
Sat, 16 Apr 2016 02:27:56 +0000 (02:27 +0000)
This significantly contributes to peak memory usage during a
LTO Release+DebugInfo build of clang. In my profile the peak usage
is around 164MB before this change and ~130MB after.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266509 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/DebugInfoMetadata.h

index dcacb41..ae5711e 100644 (file)
@@ -1868,13 +1868,16 @@ class DILocalVariable : public DIVariable {
   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)
       : DIVariable(C, DILocalVariableKind, Storage, Line, Ops), Arg(Arg),
-        Flags(Flags) {}
+        Flags(Flags) {
+    assert(Flags < ((1 << 16) - 1) && "DILocalVariable: Flags out of range");
+    assert(Arg < ((1 << 16) - 1) && "DILocalVariable: Arg out of range");
+  }
   ~DILocalVariable() = default;
 
   static DILocalVariable *getImpl(LLVMContext &Context, DIScope *Scope,