Implements C++20 std::assume_aligned from p1007:
http://wg21.link/p1007
Only Clang is initially supported.
|  Differential  D108906  
Add std::assume_aligned Authored by ldionne on Aug 30 2021, 1:06 AM. 
Details Implements C++20 std::assume_aligned from p1007: Only Clang is initially supported. 
Diff Detail 
Unit Tests Event TimelineComment Actions Disable -Wgnu-compat for the new tests since this functionality is specific to clang. Comment Actions Thanks for the patch! Can you follow the check-list at https://libcxx.llvm.org/Contributing.html (re-generating auto-gen-files, updating status pages, updating synopses, etc.)? 
 Comment Actions Also, I just re-read the thread in https://reviews.llvm.org/D54966 (in particular Chandler's comment in https://reviews.llvm.org/D54966#1340163) and my understanding was that we really want to use __builtin_assume_aligned because that will propagate the correct alignment assumption in the IR. I think the constexpr issue can be solved as: template <size_t N, typename T>
[[nodiscard]]
_LIBCPP_HIDE_FROM_ABI
constexpr T* assume_aligned(T* __ptr) {
  if (is_constant_evaluated()) {
    return __ptr;
  } else {
    return __builtin_assume_aligned(__ptr, N);
  }
}As a side benefit, this should also work on GCC (and in fact this implementation is basically what libstdc++ does). What do you think? 
 
 | ||||||||||||||||||||||||||||||||||||||||||
Those parameters should be uglified (<size_t _Np, class _Tp>). Also, we use class instead of typename -- I don't like that, but it's consistent with the rest of the code base.