@@ -3071,8 +3071,9 @@ static SILFunction *getOrCreateKeyPathGetter(SILGenModule &SGM,
3071
3071
auto baseArg = entry->createFunctionArgument (baseArgTy);
3072
3072
SILValue indexPtrArg;
3073
3073
if (!indexes.empty ()) {
3074
- auto indexArgTy = signature->getParameters ()[1 ].getSILStorageType (
3075
- SGM.M , signature, subSGF.F .getTypeExpansionContext ());
3074
+ auto indexArgTy =
3075
+ subSGF.silConv .getSILType (signature->getParameters ()[1 ], signature,
3076
+ subSGF.F .getTypeExpansionContext ());
3076
3077
indexPtrArg = entry->createFunctionArgument (indexArgTy);
3077
3078
}
3078
3079
@@ -3234,10 +3235,12 @@ static SILFunction *getOrCreateKeyPathSetter(SILGenModule &SGM,
3234
3235
subSGF.F .getTypeExpansionContext ());
3235
3236
3236
3237
auto entry = thunk->begin ();
3237
- auto valueArgTy = signature->getParameters ()[0 ].getSILStorageType (
3238
- SGM.M , signature, subSGF.getTypeExpansionContext ());
3239
- auto baseArgTy = signature->getParameters ()[1 ].getSILStorageType (
3240
- SGM.M , signature, subSGF.getTypeExpansionContext ());
3238
+ auto valueArgTy =
3239
+ subSGF.silConv .getSILType (signature->getParameters ()[0 ], signature,
3240
+ subSGF.getTypeExpansionContext ());
3241
+ auto baseArgTy =
3242
+ subSGF.silConv .getSILType (signature->getParameters ()[1 ], signature,
3243
+ subSGF.getTypeExpansionContext ());
3241
3244
if (genericEnv) {
3242
3245
valueArgTy = genericEnv->mapTypeIntoContext (SGM.M , valueArgTy);
3243
3246
baseArgTy = genericEnv->mapTypeIntoContext (SGM.M , baseArgTy);
@@ -3247,8 +3250,9 @@ static SILFunction *getOrCreateKeyPathSetter(SILGenModule &SGM,
3247
3250
SILValue indexPtrArg;
3248
3251
3249
3252
if (!indexes.empty ()) {
3250
- auto indexArgTy = signature->getParameters ()[2 ].getSILStorageType (
3251
- SGM.M , signature, subSGF.getTypeExpansionContext ());
3253
+ auto indexArgTy =
3254
+ subSGF.silConv .getSILType (signature->getParameters ()[2 ], signature,
3255
+ subSGF.getTypeExpansionContext ());
3252
3256
indexPtrArg = entry->createFunctionArgument (indexArgTy);
3253
3257
}
3254
3258
@@ -3257,9 +3261,11 @@ static SILFunction *getOrCreateKeyPathSetter(SILGenModule &SGM,
3257
3261
auto subscriptIndices =
3258
3262
loadIndexValuesForKeyPathComponent (subSGF, loc, property,
3259
3263
indexes, indexPtrArg);
3260
-
3261
- auto valueOrig = ManagedValue::forBorrowedRValue (valueArg)
3262
- .copy (subSGF, loc);
3264
+
3265
+ auto valueOrig = valueArgTy.isTrivial (subSGF.F )
3266
+ ? ManagedValue::forTrivialRValue (valueArg)
3267
+ : ManagedValue::forBorrowedRValue (valueArg);
3268
+ valueOrig = valueOrig.copy (subSGF, loc);
3263
3269
auto valueSubst = subSGF.emitOrigToSubstValue (loc, valueOrig,
3264
3270
AbstractionPattern::getOpaque (),
3265
3271
propertyType);
@@ -3414,10 +3420,10 @@ getOrCreateKeyPathEqualsAndHash(SILGenModule &SGM,
3414
3420
SILGenFunction subSGF (SGM, *equals, SGM.SwiftModule );
3415
3421
equals->setGenericEnvironment (genericEnv);
3416
3422
auto entry = equals->begin ();
3417
- auto lhsPtr = entry->createFunctionArgument (params[ 0 ]. getSILStorageType (
3418
- SGM. M , signature, subSGF.getTypeExpansionContext ()));
3419
- auto rhsPtr = entry->createFunctionArgument (params[ 1 ]. getSILStorageType (
3420
- SGM. M , signature, subSGF.getTypeExpansionContext ()));
3423
+ auto lhsPtr = entry->createFunctionArgument (subSGF. silConv . getSILType (
3424
+ params[ 0 ] , signature, subSGF.getTypeExpansionContext ()));
3425
+ auto rhsPtr = entry->createFunctionArgument (subSGF. silConv . getSILType (
3426
+ params[ 1 ] , signature, subSGF.getTypeExpansionContext ()));
3421
3427
3422
3428
Scope scope (subSGF, loc);
3423
3429
@@ -3588,8 +3594,8 @@ getOrCreateKeyPathEqualsAndHash(SILGenModule &SGM,
3588
3594
SILGenFunction subSGF (SGM, *hash, SGM.SwiftModule );
3589
3595
hash->setGenericEnvironment (genericEnv);
3590
3596
auto entry = hash->begin ();
3591
- auto indexPtr = entry->createFunctionArgument (params[ 0 ]. getSILStorageType (
3592
- SGM. M , signature, subSGF.getTypeExpansionContext ()));
3597
+ auto indexPtr = entry->createFunctionArgument (subSGF. silConv . getSILType (
3598
+ params[ 0 ] , signature, subSGF.getTypeExpansionContext ()));
3593
3599
3594
3600
SILValue hashCode;
3595
3601
0 commit comments