mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
[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. Reviewers: dblaikie, RKSimon, hans, davide Reviewed By: davide Subscribers: davide, llvm-commits Differential Revision: https://reviews.llvm.org/D32001 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300171 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -120,7 +120,7 @@ APInt::APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[])
|
||||
}
|
||||
|
||||
APInt::APInt(unsigned numbits, StringRef Str, uint8_t radix)
|
||||
: BitWidth(numbits), VAL(0) {
|
||||
: VAL(0), BitWidth(numbits) {
|
||||
assert(BitWidth && "Bitwidth too small");
|
||||
fromString(numbits, Str, radix);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user