diff --git a/lib/SILOptimizer/Mandatory/Differentiation.cpp b/lib/SILOptimizer/Mandatory/Differentiation.cpp index d039f10b382c8..babb3e0aac2a9 100644 --- a/lib/SILOptimizer/Mandatory/Differentiation.cpp +++ b/lib/SILOptimizer/Mandatory/Differentiation.cpp @@ -4691,7 +4691,8 @@ class JVPEmitter final CLONE_AND_EMIT_TANGENT(AllocStack, asi) { auto &diffBuilder = getDifferentialBuilder(); auto *mappedAllocStackInst = diffBuilder.createAllocStack( - asi->getLoc(), getRemappedTangentType(asi->getElementType())); + asi->getLoc(), getRemappedTangentType(asi->getElementType()), + asi->getVarInfo()); bufferMap.try_emplace({asi->getParent(), asi}, mappedAllocStackInst); } @@ -6112,7 +6113,7 @@ class PullbackEmitter final : public SILInstructionVisitor { // Allocate local buffer and initialize to zero. auto bufObjectType = getRemappedTangentType(originalBuffer->getType()); auto *newBuf = localAllocBuilder.createAllocStack( - originalBuffer.getLoc(), bufObjectType); + RegularLocation::getAutoGeneratedLocation(), bufObjectType); // Temporarily change global builder insertion point and emit zero into the // local buffer. auto insertionPoint = builder.getInsertionBB();