@@ -376,7 +376,8 @@ SILValue PullbackEmitter::getAdjointProjection(SILBasicBlock *origBB,
376
376
auto *tanField = cast<VarDecl>(tanFieldLookup.front ());
377
377
// Create a local allocation for the element adjoint buffer.
378
378
auto eltTanType = tanField->getValueInterfaceType ()->getCanonicalType ();
379
- auto eltTanSILType = SILType::getPrimitiveAddressType (eltTanType);
379
+ auto eltTanSILType =
380
+ remapType (SILType::getPrimitiveAddressType (eltTanType));
380
381
auto *eltAdjBuffer = createFunctionLocalAllocation (eltTanSILType, loc);
381
382
builder.emitScopedBorrowOperation (
382
383
loc, adjClass, [&](SILValue borrowedAdjClass) {
@@ -1090,7 +1091,7 @@ PullbackEmitter::getArrayAdjointElementBuffer(SILValue arrayAdjoint,
1090
1091
auto arrayTanType = cast<StructType>(arrayAdjoint->getType ().getASTType ());
1091
1092
auto arrayType = arrayTanType->getParent ()->castTo <BoundGenericStructType>();
1092
1093
auto eltTanType = arrayType->getGenericArgs ().front ()->getCanonicalType ();
1093
- auto eltTanSILType = SILType::getPrimitiveAddressType (eltTanType);
1094
+ auto eltTanSILType = remapType ( SILType::getPrimitiveAddressType (eltTanType) );
1094
1095
// Get `function_ref` and generic signature of
1095
1096
// `Array.TangentVector.subscript.getter`.
1096
1097
auto *arrayTanStructDecl = arrayTanType->getStructOrBoundGenericStruct ();
@@ -1602,12 +1603,11 @@ void PullbackEmitter::visitLoadOperation(SingleValueInstruction *inst) {
1602
1603
void PullbackEmitter::visitStoreOperation (SILBasicBlock *bb, SILLocation loc,
1603
1604
SILValue origSrc, SILValue origDest) {
1604
1605
auto &adjBuf = getAdjointBuffer (bb, origDest);
1605
- auto bufType = remapType (adjBuf->getType ());
1606
1606
auto adjVal =
1607
1607
builder.emitLoadValueOperation (loc, adjBuf, LoadOwnershipQualifier::Take);
1608
1608
recordTemporary (adjVal);
1609
1609
addAdjointValue (bb, origSrc, makeConcreteAdjointValue (adjVal), loc);
1610
- emitZeroIndirect (bufType .getASTType (), adjBuf, loc);
1610
+ emitZeroIndirect (adjBuf-> getType () .getASTType (), adjBuf, loc);
1611
1611
}
1612
1612
1613
1613
void PullbackEmitter::visitStoreInst (StoreInst *si) {
0 commit comments