TypeID Alignment

It came up in my external pass review that TypeID pointers are supposed to be aligned to 8 bytes. It looks like this is so the bottom 3 bits can be used for other purposes. I was curious if this functionality was actually being used for TypeID somewhere.

Anywhere that we use PointerUnion/PointerIntPair/etc. relies on data being aligned in a certain way, given that it controls the number of bits available. I can’t remember if we have bit stealing for TypeID upstream right now, but we definitely do downstream. Force aligning to a specific width (e.g. 8 which is what we align by on 64-bit platforms) avoids build errors when switching to a platform with a smaller alignment.

1 Like