Skip to content

Commit 8d336a3

Browse files
authored
[AutoDiff] NFC: gardening. (swiftlang#33914)
1 parent d9a13bc commit 8d336a3

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

lib/SILOptimizer/Differentiation/JVPCloner.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ class JVPCloner::Implementation final
282282
assert(originalValue->getType().isObject());
283283
assert(newTangentValue.getType().isObject());
284284
assert(originalValue->getFunction() == original);
285-
LLVM_DEBUG(getADDebugStream() << "Adding tangent for " << originalValue);
285+
LLVM_DEBUG(getADDebugStream()
286+
<< "Setting tangent value for " << originalValue);
286287
// The tangent value must be in the tangent space.
287288
assert(newTangentValue.getType() ==
288289
getRemappedTangentType(originalValue->getType()));
@@ -1221,10 +1222,10 @@ class JVPCloner::Implementation final
12211222
for (auto indRes : ai->getIndirectSILResults())
12221223
diffArgs.push_back(getTangentBuffer(bb, indRes));
12231224

1224-
auto paramArgs = ai->getArgumentsWithoutIndirectResults();
1225+
auto origArgs = ai->getArgumentsWithoutIndirectResults();
12251226
// Get the tangent value of the original arguments.
1226-
for (auto i : indices(paramArgs)) {
1227-
auto origArg = paramArgs[i];
1227+
for (auto i : indices(origArgs)) {
1228+
auto origArg = origArgs[i];
12281229
// If the argument is not active:
12291230
// - Skip the element, if it is not differentiable.
12301231
// - Otherwise, add a zero value to that location.
@@ -1565,8 +1566,8 @@ void JVPCloner::Implementation::prepareForDifferentialGeneration() {
15651566
// If original indirect result is non-varied, zero-initialize its tangent
15661567
// buffer.
15671568
if (!activityInfo.isVaried(origResult, getIndices().parameters))
1568-
emitZeroIndirect(diffIndResult->getType().getASTType(),
1569-
diffIndResult, diffLoc);
1569+
emitZeroIndirect(diffIndResult->getType().getASTType(), diffIndResult,
1570+
diffLoc);
15701571
continue;
15711572
}
15721573
// Handle original non-wrt `inout` parameter.
@@ -1583,8 +1584,8 @@ void JVPCloner::Implementation::prepareForDifferentialGeneration() {
15831584
setTangentBuffer(origEntry, origResult, diffIndResult);
15841585
// Original `inout` parameters are initialized, so their tangent buffers
15851586
// must also be initialized.
1586-
emitZeroIndirect(diffIndResult->getType().getASTType(),
1587-
diffIndResult, diffLoc);
1587+
emitZeroIndirect(diffIndResult->getType().getASTType(), diffIndResult,
1588+
diffLoc);
15881589
}
15891590
}
15901591

lib/SILOptimizer/Differentiation/PullbackCloner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2432,7 +2432,8 @@ void PullbackCloner::Implementation::visitSILBasicBlock(SILBasicBlock *bb) {
24322432
if (isSwitchEnumInstOnOptional(termInst)) {
24332433
accumulateAdjointForOptional(bb, incomingValue, concreteBBArgAdjCopy);
24342434
} else {
2435-
blockTemporaries[getPullbackBlock(predBB)].insert(concreteBBArgAdjCopy);
2435+
blockTemporaries[getPullbackBlock(predBB)].insert(
2436+
concreteBBArgAdjCopy);
24362437
setAdjointValue(predBB, incomingValue,
24372438
makeConcreteAdjointValue(concreteBBArgAdjCopy));
24382439
}

0 commit comments

Comments
 (0)