llvm-project
2f91c9c9 - [CodeGen] Relax an overly strict assert in EmitAggregateCopy (#219090)

Commit
8 days ago
[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
Author
Parents
Loading