@@ -2698,28 +2698,26 @@ static SILFunction *getOrCreateKeyPathGetter(SILGenModule &SGM,
26982698 : nullptr ;
26992699
27002700 // Build the signature of the thunk as expected by the keypath runtime.
2701- SILType loweredBaseTy, loweredPropTy;
2701+ CanType loweredBaseTy, loweredPropTy;
27022702 {
27032703 GenericContextScope scope (SGM.Types , genericSig);
2704- loweredBaseTy = SGM. Types . getLoweredType ( AbstractionPattern::getOpaque (),
2705- baseType);
2706- loweredPropTy = SGM.Types .getLoweredType ( AbstractionPattern::getOpaque (),
2707- propertyType);
2704+ AbstractionPattern opaque = AbstractionPattern::getOpaque ();
2705+
2706+ loweredBaseTy = SGM.Types .getLoweredRValueType (opaque, baseType);
2707+ loweredPropTy = SGM. Types . getLoweredRValueType (opaque, propertyType);
27082708 }
27092709
27102710 auto paramConvention = ParameterConvention::Indirect_In_Guaranteed;
27112711
27122712 SmallVector<SILParameterInfo, 2 > params;
2713- params.push_back ({loweredBaseTy.getASTType (),
2714- paramConvention});
2713+ params.push_back ({loweredBaseTy, paramConvention});
27152714 auto &C = SGM.getASTContext ();
27162715 if (!indexes.empty ())
27172716 params.push_back ({C.getUnsafeRawPointerDecl ()->getDeclaredType ()
27182717 ->getCanonicalType (),
27192718 ParameterConvention::Direct_Unowned});
27202719
2721- SILResultInfo result (loweredPropTy.getASTType (),
2722- ResultConvention::Indirect);
2720+ SILResultInfo result (loweredPropTy, ResultConvention::Indirect);
27232721
27242722 auto signature = SILFunctionType::get (genericSig,
27252723 SILFunctionType::ExtInfo (SILFunctionType::Representation::Thin,
@@ -2828,13 +2826,13 @@ static SILFunction *getOrCreateKeyPathSetter(SILGenModule &SGM,
28282826 : nullptr ;
28292827
28302828 // Build the signature of the thunk as expected by the keypath runtime.
2831- SILType loweredBaseTy, loweredPropTy;
2829+ CanType loweredBaseTy, loweredPropTy;
28322830 {
28332831 GenericContextScope scope (SGM.Types , genericSig);
2834- loweredBaseTy = SGM. Types . getLoweredType ( AbstractionPattern::getOpaque (),
2835- baseType);
2836- loweredPropTy = SGM.Types .getLoweredType ( AbstractionPattern::getOpaque (),
2837- propertyType);
2832+ AbstractionPattern opaque = AbstractionPattern::getOpaque ();
2833+
2834+ loweredBaseTy = SGM.Types .getLoweredRValueType (opaque, baseType);
2835+ loweredPropTy = SGM. Types . getLoweredRValueType (opaque, propertyType);
28382836 }
28392837
28402838 auto &C = SGM.getASTContext ();
@@ -2843,10 +2841,9 @@ static SILFunction *getOrCreateKeyPathSetter(SILGenModule &SGM,
28432841
28442842 SmallVector<SILParameterInfo, 3 > params;
28452843 // property value
2846- params.push_back ({loweredPropTy.getASTType (),
2847- paramConvention});
2844+ params.push_back ({loweredPropTy, paramConvention});
28482845 // base
2849- params.push_back ({loweredBaseTy. getASTType () ,
2846+ params.push_back ({loweredBaseTy,
28502847 property->isSetterMutating ()
28512848 ? ParameterConvention::Indirect_Inout
28522849 : paramConvention});
@@ -3007,7 +3004,10 @@ getOrCreateKeyPathEqualsAndHash(SILGenModule &SGM,
30073004 ->getCanonicalType ();
30083005 RValue indexValue (indexTupleTy);
30093006
3010- auto indexLoweredTy = SGM.Types .getLoweredType (indexTupleTy);
3007+ auto indexLoweredTy =
3008+ SILType::getPrimitiveAddressType (
3009+ SGM.Types .getLoweredRValueType (indexTupleTy));
3010+
30113011 // Get or create the equals witness
30123012 [unsafeRawPointerTy, boolTy, genericSig, &C, &indexTypes, &equals, loc,
30133013 &SGM, genericEnv, expansion, indexLoweredTy, indexes]{
@@ -3052,10 +3052,10 @@ getOrCreateKeyPathEqualsAndHash(SILGenModule &SGM,
30523052 Scope scope (subSGF, loc);
30533053
30543054 auto lhsAddr = subSGF.B .createPointerToAddress (loc, lhsPtr,
3055- indexLoweredTy. getAddressType () ,
3055+ indexLoweredTy,
30563056 /* isStrict*/ false );
30573057 auto rhsAddr = subSGF.B .createPointerToAddress (loc, rhsPtr,
3058- indexLoweredTy. getAddressType () ,
3058+ indexLoweredTy,
30593059 /* isStrict*/ false );
30603060
30613061 // Compare each pair of index values using the == witness from the
@@ -3229,7 +3229,7 @@ getOrCreateKeyPathEqualsAndHash(SILGenModule &SGM,
32293229
32303230 // Extract the index value.
32313231 SILValue indexAddr = subSGF.B .createPointerToAddress (loc, indexPtr,
3232- indexLoweredTy. getAddressType () ,
3232+ indexLoweredTy,
32333233 /* isStrict*/ false );
32343234 if (indexes.size () > 1 ) {
32353235 indexAddr = subSGF.B .createTupleElementAddr (loc, indexAddr, 0 );
0 commit comments