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

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 13:26:42 PDT 2023


adrian-prantl wrote:

> > Just added some tests!
> 
> Thanks!
> 
> > Motivation wise: Swift has builtin types which are non-byte-size. For example, the builtin that the standard boolean wraps is 1 bit long.
> 
> Hmm, I'm still not sure about this - if the DWARF is describing it as being 1 byte long, presumably that ABI has to actually allocate a byte for this type? So in what sense is the type only 1 bit long?

Swift allows packing values in aggregates under certain circumstances. For example the type `Bool?` a.k.a. `Optional<Bool>` stores the discriminator bit of the Optional enum type in bit #1 and the Bool in bit #0 of the same type. For these applications the bit size is relevant.

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


More information about the llvm-commits mailing list