llvm.org GIT mirror llvm / 55e47a6
[IR] Optimize memory usage of Metadata on MSVC An unsigned 2 bit bitfield takes 4 bytes in MSVC. Instead of a bitfield, just use an unsigned char. We can go back to a bitfield when someone implements the TODO of exposing and reusing the remaining 6 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266256 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Kleckner 3 years ago
1 changed file(s) with 2 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
5151 enum StorageType { Uniqued, Distinct, Temporary };
5252
5353 /// \brief Storage flag for non-uniqued, otherwise unowned, metadata.
54 unsigned Storage : 2;
54 unsigned char Storage;
5555 // TODO: expose remaining bits to subclasses.
5656
5757 unsigned short SubclassData16;
9292 protected:
9393 Metadata(unsigned ID, StorageType Storage)
9494 : SubclassID(ID), Storage(Storage), SubclassData16(0), SubclassData32(0) {
95 static_assert(sizeof(*this) == 8, "Metdata fields poorly packed");
9596 }
9697 ~Metadata() = default;
9798