[llvm] Fix size in bytes of type DIEs when size in bits is not a multiple of 8 (PR #69741)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 08:53:50 PST 2023


dwblaikie wrote:

> > I'm still a bit confused - it seems like the actual size (like what happens if you create an array of these things? I assume it's size is actually in bytes, right?) is still in bytes. But like tail padding in C++ - sometimes derived objects can use some of that padding/size for other stuff too. It doesn't mean the base class is smaller - it's got to be a whole byte for alignment reasons, etc, but the padding bits can be reused.
> 
> Yes, the actual size is still in bytes. I think I will emit the correct size in the front end instead, but I think the current implementation that silently rounds down the bits to the bytes is wrong, so we should do something about that separately.

Yeah - not sure why we even encode it as bits. Maybe we use the bit size for bitfields? A verifier check that the size is a multiple of 8 in cases other than bitfields might be suitable?

https://github.com/llvm/llvm-project/pull/69741


More information about the llvm-commits mailing list