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

Richard Smith - zygoloid via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 24 16:13:33 PDT 2019


rsmith created this revision.
rsmith added reviewers: EricWF, mclow.lists.
Herald added subscribers: jdoerfert, christof, aprantl.
Herald added a project: libc++.

Adds a new __config macro _LIBCPP_USE_NO_UNIQUE_ADDRESS that specifies when to
use [[no_unique_address]] (instead of __compressed_pair or similar layout
hacks). This macro is defined only when the unstable ABI is enabled and
[[no_unique_address]] is available.

This reduces the number of template instantiations, compile-time cost, size of
debug information, and number of copies performed when using various parts of
libc++. In one source file, we saw a 4% decrease in object file size from
switching std::function to use [[no_unique_address]] instead of
__compressed_pair stemming primarily from reduced debug info size.

This patch does not intend to provide any ABI compatibility between the new
mode and old modes (or between two different compilers with the unstable ABI
enabled, where one supports [[no_unique_address]] and the other does not).
If we want a hard guarantee that even the unstable ABI provides stability
between compilers, we'll need to provide user control over whether we apply
this optimization rather than doing it whenever possible in the unstable ABI.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63744

Files:
  libcxx/include/__config
  libcxx/include/__hash_table
  libcxx/include/__split_buffer
  libcxx/include/__tree
  libcxx/include/deque
  libcxx/include/forward_list
  libcxx/include/functional
  libcxx/include/future
  libcxx/include/list
  libcxx/include/memory
  libcxx/include/string
  libcxx/include/vector
  libcxx/test/libcxx/containers/unord/unord.set/missing_hash_specialization.fail.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.fail.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63744.206321.patch
Type: text/x-patch
Size: 84653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190624/5ca03776/attachment-0001.bin>


More information about the libcxx-commits mailing list