[libcxx-commits] [PATCH] D63744: In the libc++ unstable ABI, use [[no_unique_address]] instead of __compressed_pair when available.

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 2 15:03:55 PST 2020


zoecarver added a comment.

In D63744#2369735 <https://reviews.llvm.org/D63744#2369735>, @ldionne wrote:

> In D63744#2369727 <https://reviews.llvm.org/D63744#2369727>, @zoecarver wrote:
>
>>> If we assume that the compiler supports [[no_unique_address]], is this an ABI break? Does no_unique_address result in a different layout than the __compressed_pair?
>>
>> This is only enabled in the unstable ABI so I think it's OK.
>
> The fact that it's only enabled in the unstable ABI causes all this `#ifdef` mess, which is the reason why this patch has not landed yet. I'm trying to figure out whether we can use `__attribute__((no_unique_address))` in the stable ABI too. If we don't assume the compiler supports it then we can't (because then it would break ABI between compilers), but if we require the compiler to support it, then we might be okay. That's my question :-).

I misunderstood what you were saying. Hmm, that's an interesting idea. I think you're right, they would always have the same layout. Because if `is_empty_v<T> == true` then `__compressed_pair_elem` acts as an empty base class, so it would have the same effect as a member with `[[no_unique_address]]`. This wouldn't hold true if any of the compilers we support don't //always// implement empty base optimizations, though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63744/new/

https://reviews.llvm.org/D63744



More information about the libcxx-commits mailing list