diff --git a/lib/SILOptimizer/Differentiation/PullbackCloner.cpp b/lib/SILOptimizer/Differentiation/PullbackCloner.cpp index 1ea2cc3ebbef6..5290f9726b31d 100644 --- a/lib/SILOptimizer/Differentiation/PullbackCloner.cpp +++ b/lib/SILOptimizer/Differentiation/PullbackCloner.cpp @@ -3284,7 +3284,7 @@ SILValue PullbackCloner::Implementation::getAdjointProjection( auto adjSource = getAdjointBuffer(origBB, source); if (!adjSource->getType().is()) return adjSource; - auto origTupleTy = source->getType().castTo(); + auto origTupleTy = remapType(source->getType()).castTo(); unsigned adjIndex = 0; for (unsigned i : range(teai->getFieldIndex())) { if (getTangentSpace( diff --git a/test/AutoDiff/validation-test/array.swift b/test/AutoDiff/validation-test/array.swift index 7c85c807c1190..9e0bf322c5558 100644 --- a/test/AutoDiff/validation-test/array.swift +++ b/test/AutoDiff/validation-test/array.swift @@ -192,10 +192,7 @@ ArrayAutoDiffTests.test("ArrayLiteralTuple") { return [tuple.0, tuple.1] } let pb = pullback(at: Float(3), 4, of: { tupleElementGeneric($0, $1) }) - // FIXME(TF-977): Fix incorrect derivative for array literal with - // `tuple_element_addr` elements. - // expectEqual((1, 1), pb(FloatArrayTan([1, 1]))) - expectEqual((0, 2), pb(FloatArrayTan([1, 1]))) + expectEqual((1, 1), pb(FloatArrayTan([1, 1]))) } }