[llvm] r300171 - [APInt] Reorder fields to avoid a hole in the middle of the class

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 09:19:12 PDT 2017


works for me.

On Apr 13, 2017 12:43 AM, "Craig Topper" <craig.topper at gmail.com> wrote:

> Would it be sufficient to add a static_assert to APSInt.h?  Can't do it in
> APInt.h because the padding is counted in sizeof whether its in the middle
> or at the end.
>
> ~Craig
>
> On Wed, Apr 12, 2017 at 11:36 PM, Davide Italiano <davide at freebsd.org>
> wrote:
>
>> On Wed, Apr 12, 2017 at 9:59 PM, Craig Topper via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>> > Author: ctopper
>> > Date: Wed Apr 12 23:59:11 2017
>> > New Revision: 300171
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=300171&view=rev
>> > Log:
>> > [APInt] Reorder fields to avoid a hole in the middle of the class
>> >
>> > Summary:
>> > APInt is currently implemented with an unsigned BitWidth field first
>> and then a uint_64/pointer union. Due to the 64-bit size of the union there
>> is a hole after the bitwidth.
>> >
>> > Putting the union first allows the class to be packed. Making it 12
>> bytes instead of 16 bytes. An APSInt goes from 20 bytes to 16 bytes.
>> >
>> > This shows a 4k reduction on the size of the opt binary on my local
>> x86-64 build. So this enables some other improvement to the code as well.
>> >
>>
>> As mentioned in the review, can you please try to write an unittest to
>> make sure this doesn't break in future?
>>
>> Thanks,
>>
>> --
>> Davide
>>
>> "There are no solved problems; there are only problems that are more
>> or less solved" -- Henri Poincare
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170413/78b4cb31/attachment.html>


More information about the llvm-commits mailing list