[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 20:34:24 PDT 2016


On Fri, Apr 15, 2016 at 8:21 PM, Duncan P. N. Exon Smith
<dexonsmith at apple.com> wrote:
>
>> On 2016-Apr-15, at 20:14, Davide Italiano <davide at freebsd.org> wrote:
>>
>> On Fri, Apr 15, 2016 at 7:57 PM, Duncan P. N. Exon Smith
>> <dexonsmith at apple.com> wrote:
>>>
>>>> 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?
>>>
>>
>> No, x86_64.
>
> Yup, I missed the 32-bits in DIVariable.
>
> You may be able to shave some bits off of MDNode::NumOperands and
> MDNode::NumUnresolved.  I'm not sure you can get enough to help, but
> maybe.
>

The failures should be fixed (r266512). I missed because I ran tests
without assertions, sorry :|
Your suggestion is nice, I'll take a look at it.

>>
>>> 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?
>>>
>>
>> Sorry, looking at the failures now.
>>
>>>>
>>>>  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
>>>
>>
>>
>>
>> --
>> Davide
>>
>> "There are no solved problems; there are only problems that are more
>> or less solved" -- Henri Poincare
>



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list