Skip to content

Commit 8f35b0f

Browse files
authored
---
yaml --- r: 341630 b: refs/heads/rxwei-patch-1 c: 427b19b h: refs/heads/master
1 parent dccdf81 commit 8f35b0f

File tree

7 files changed

+470
-619
lines changed

7 files changed

+470
-619
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: c9df276084b07cf70445ff2d6d6cbd2901380499
1018+
refs/heads/rxwei-patch-1: 427b19b62dbffbde033be770ea85b3daaf8246d9
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/lib/SIL/SILFunctionType.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,19 @@ CanSILFunctionType SILFunctionType::getAutoDiffAssociatedFunctionType(
231231
case AutoDiffAssociatedFunctionKind::JVP: {
232232
SmallVector<SILParameterInfo, 8> differentialParams;
233233
for (auto &param : wrtParams) {
234+
auto paramTan =
235+
param.getType()->getAutoDiffAssociatedTangentSpace(lookupConformance);
236+
assert(paramTan && "Parameter type does not have a tangent space?");
234237
differentialParams.push_back(
235-
{param.getType()->getAutoDiffAssociatedTangentSpace(lookupConformance)
236-
->getCanonicalType(),
237-
param.getConvention()});
238+
{paramTan->getCanonicalType(), param.getConvention()});
238239
}
239240
SmallVector<SILResultInfo, 8> differentialResults;
240241
auto &result = getResults()[resultIndex];
242+
auto resultTan =
243+
result.getType()->getAutoDiffAssociatedTangentSpace(lookupConformance);
244+
assert(resultTan && "Result type does not have a tangent space?");
241245
differentialResults.push_back(
242-
{result.getType()->getAutoDiffAssociatedTangentSpace(lookupConformance)
243-
->getCanonicalType(),
244-
result.getConvention()});
246+
{resultTan->getCanonicalType(), result.getConvention()});
245247
closureType = SILFunctionType::get(
246248
/*genericSignature*/ nullptr, ExtInfo(), SILCoroutineKind::None,
247249
ParameterConvention::Direct_Guaranteed, differentialParams, {},
@@ -251,19 +253,19 @@ CanSILFunctionType SILFunctionType::getAutoDiffAssociatedFunctionType(
251253
case AutoDiffAssociatedFunctionKind::VJP: {
252254
SmallVector<SILParameterInfo, 8> pullbackParams;
253255
auto &origRes = getResults()[resultIndex];
254-
auto tangentAssocTy =
255-
origRes.getType()->getAutoDiffAssociatedTangentSpace(lookupConformance)
256-
->getCanonicalType();
256+
auto resultTan =
257+
origRes.getType()->getAutoDiffAssociatedTangentSpace(lookupConformance);
258+
assert(resultTan && "Result type does not have a tangent space?");
257259
pullbackParams.push_back(
258-
getTangentParameterInfoForOriginalResult(tangentAssocTy,
260+
getTangentParameterInfoForOriginalResult(resultTan->getCanonicalType(),
259261
origRes.getConvention()));
260262
SmallVector<SILResultInfo, 8> pullbackResults;
261263
for (auto &param : wrtParams) {
262-
auto paramTangentTy =
263-
param.getType()->getAutoDiffAssociatedTangentSpace(lookupConformance)
264-
->getCanonicalType();
264+
auto paramTan =
265+
param.getType()->getAutoDiffAssociatedTangentSpace(lookupConformance);
266+
assert(paramTan && "Parameter type does not have a tangent space?");
265267
pullbackResults.push_back(
266-
getTangentResultInfoForOriginalParameter(paramTangentTy,
268+
getTangentResultInfoForOriginalParameter(paramTan->getCanonicalType(),
267269
param.getConvention()));
268270
}
269271
closureType = SILFunctionType::get(

0 commit comments

Comments
 (0)