[PATCH] D114732: [clang] Mark `trivial_abi` types as "trivially relocatable".

Devin Jeanpierre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 4 09:36:53 PST 2022


devin.jeanpierre added a comment.

The core difference of behavior is this, in the logic for setting `canPassInRegisters`:

  // Clang <= 4 used the pre-C++11 rule, which ignores move operations.
  // The PS4 platform ABI follows the behavior of Clang 3.2.
  if (CCK == TargetInfo::CCK_ClangABI4OrPS4)
    return !D->hasNonTrivialDestructorForCall() &&
           !D->hasNonTrivialCopyConstructorForCall();

This is noticeably different from the non-PS4 behavior: not only does it ignore the move constructor, but it also does not require that a copy constructor or destructor even exist. And so all of the broken tests are structs where the copy constructor is deleted and the destructor is either trivial or deleted. On non-`CCK_ClangABI4OrPS4`, it is not passable in registers, but on `CCK_ClangABI4OrPS4` it is.

Related, but separate: DR1734, which is the same thing, but for `std::is_trivially_copyable`.

I believe the fix here, like for Windows, is to special-case this platform in the test. (Or delete these tests.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114732



More information about the cfe-commits mailing list