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

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 15 19:57:11 PDT 2016


> On 2016-Apr-15, at 19:27, Davide Italiano via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 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;

How does this save memory?  Are you on a 32-bit platform?

BTW, I think there was some use case where someone needed an insane
number of arguments.  I don't remember what it was though.  Might
explain the bot failures?

> 
>   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,
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list