[all-commits] [llvm/llvm-project] 2f91c9: [CodeGen] Relax an overly strict assert in EmitAgg...

Akira Hatanaka via All-commits all-commits at lists.llvm.org
Wed Sep 9 12:34:50 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2f91c9c95a93be6d559dd0028a35c9f5e15d3dcf
      https://github.com/llvm/llvm-project/commit/2f91c9c95a93be6d559dd0028a35c9f5e15d3dcf
  Author: Akira Hatanaka <ahatanak at gmail.com>
  Date:   2026-09-09 (Wed, 09 Sep 2026)

  Changed paths:
    M clang/lib/CodeGen/CGExprAgg.cpp
    M clang/test/CodeGenObjCXX/arc-forwarded-lambda-call.mm

  Log Message:
  -----------
  [CodeGen] Relax an overly strict assert in EmitAggregateCopy (#219090)

EmitAggregateCopy contains a sanity check verifying that a record being
bitwise copied has a genuinely trivial copy/move constructor or
assignment operator. The check did not account for records that are
non-trivial only because they contain an ARC __strong field. Such
records are still trivial for the purposes of calls, so clang can
legitimately use memcpy to copy them when passing or returning the type
by value.

Relax the assertion by using hasTrivialCopyConstructorForCall() and
hasTrivialMoveConstructorForCall() instead of the plain
hasTrivialCopyConstructor()/hasTrivialMoveConstructor() checks, since
these are exactly the predicates that capture that notion of triviality
for calls. This also makes the separate hasAttr<TrivialABIAttr>() check
redundant, since the trivial_abi attribute unconditionally sets the
for-call bits for the copy constructor, move constructor, and
destructor.

rdar://182749806



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list