<div dir="ltr">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.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Wed, Apr 12, 2017 at 11:36 PM, Davide Italiano <span dir="ltr"><<a href="mailto:davide@freebsd.org" target="_blank">davide@freebsd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Apr 12, 2017 at 9:59 PM, Craig Topper via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: ctopper<br>
> Date: Wed Apr 12 23:59:11 2017<br>
> New Revision: 300171<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=300171&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=300171&view=rev</a><br>
> Log:<br>
> [APInt] Reorder fields to avoid a hole in the middle of the class<br>
><br>
> Summary:<br>
> 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.<br>
><br>
> 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.<br>
><br>
> 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.<br>
><br>
<br>
As mentioned in the review, can you please try to write an unittest to<br>
make sure this doesn't break in future?<br>
<br>
Thanks,<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Davide<br>
<br>
"There are no solved problems; there are only problems that are more<br>
or less solved" -- Henri Poincare<br>
</font></span></blockquote></div><br></div>