@@ -195,6 +195,25 @@ class RecordTypeInfoImpl : public Base,
195195 return emitAssignWithTakeCall (IGF, T, dest, src);
196196 }
197197
198+ if (auto rawLayout = T.getRawLayout ()) {
199+ // Because we have a rawlayout attribute, we know this has to be a struct.
200+ auto structDecl = T.getStructOrBoundGenericStruct ();
201+
202+ if (auto likeType = rawLayout->getResolvedScalarLikeType (structDecl)) {
203+ if (rawLayout->shouldMoveAsLikeType ()) {
204+ auto astT = T.getASTType ();
205+ auto subs = astT->getContextSubstitutionMap (IGF.IGM .getSwiftModule (),
206+ structDecl);
207+ auto loweredLikeType = IGF.IGM .getLoweredType (likeType->subst (subs));
208+ auto &likeTypeInfo = IGF.IGM .getTypeInfo (loweredLikeType);
209+
210+ likeTypeInfo.assignWithTake (IGF, dest, src, loweredLikeType,
211+ isOutlined);
212+ return ;
213+ }
214+ }
215+ }
216+
198217 if (isOutlined || T.hasParameterizedExistential ()) {
199218 auto offsets = asImpl ().getNonFixedOffsets (IGF, T);
200219 for (auto &field : getFields ()) {
@@ -257,6 +276,24 @@ class RecordTypeInfoImpl : public Base,
257276 return emitInitializeWithTakeCall (IGF, T, dest, src);
258277 }
259278
279+ if (auto rawLayout = T.getRawLayout ()) {
280+ // Because we have a rawlayout attribute, we know this has to be a struct.
281+ auto structDecl = T.getStructOrBoundGenericStruct ();
282+
283+ if (auto likeType = rawLayout->getResolvedScalarLikeType (structDecl)) {
284+ if (rawLayout->shouldMoveAsLikeType ()) {
285+ auto astT = T.getASTType ();
286+ auto subs = astT->getContextSubstitutionMap (IGF.IGM .getSwiftModule (),
287+ structDecl);
288+ auto loweredLikeType = IGF.IGM .getLoweredType (likeType->subst (subs));
289+ auto &likeTypeInfo = IGF.IGM .getTypeInfo (loweredLikeType);
290+
291+ likeTypeInfo.initializeWithTake (IGF, dest, src, loweredLikeType,
292+ isOutlined);
293+ }
294+ }
295+ }
296+
260297 if (isOutlined || T.hasParameterizedExistential ()) {
261298 auto offsets = asImpl ().getNonFixedOffsets (IGF, T);
262299 for (auto &field : getFields ()) {
0 commit comments