[llvm] r266509 - [DebugInfo] Reduce size of DILocalVariable from 40 to 32 bytes.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 15 19:27:56 PDT 2016


Author: davide
Date: Fri Apr 15 21:27:56 2016
New Revision: 266509

URL: http://llvm.org/viewvc/llvm-project?rev=266509&view=rev
Log:
[DebugInfo] Reduce size of DILocalVariable from 40 to 32 bytes.

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.

Modified:
    llvm/trunk/include/llvm/IR/DebugInfoMetadata.h

Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=266509&r1=266508&r2=266509&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Fri Apr 15 21:27:56 2016
@@ -1868,13 +1868,16 @@ class DILocalVariable : public DIVariabl
   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,




More information about the llvm-commits mailing list