Skip to content

Commit 931865d

Browse files
committed
clang-format updates.
1 parent 1a7e8b6 commit 931865d

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

lib/SILOptimizer/Mandatory/Differentiation.cpp

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,8 +1491,8 @@ LinearMapInfo::LinearMapInfo(ADContext &context,
14911491
populateLinearMapStructDeclarationFields(context, indices, assocFn);
14921492
}
14931493

1494-
bool LinearMapInfo::shouldBeDifferentiated(
1495-
ApplyInst *ai, const SILAutoDiffIndices &indices) {
1494+
bool LinearMapInfo::shouldBeDifferentiated(ApplyInst *ai,
1495+
const SILAutoDiffIndices &indices) {
14961496
// Anything with an active result should be differentiated.
14971497
if (llvm::any_of(ai->getResults(), [&](SILValue val) {
14981498
return activityInfo.isActive(val, indices);
@@ -1618,9 +1618,10 @@ bool LinearMapInfo::shouldBeDifferentiated(
16181618

16191619
// If function is already marked differentiable, differentiate WRT
16201620
// all parameters.
1621-
auto originalFnSubstTy = ai->getSubstCalleeType();;
1621+
auto originalFnSubstTy = ai->getSubstCalleeType();
16221622
if (originalFnSubstTy->isDifferentiable()) {
1623-
parameters = originalFnSubstTy->getDifferentiationParameterIndices();
1623+
parameters =
1624+
originalFnSubstTy->getDifferentiationParameterIndices();
16241625
} else {
16251626
parameters = AutoDiffIndexSubset::get(
16261627
original->getASTContext(),
@@ -1633,11 +1634,12 @@ bool LinearMapInfo::shouldBeDifferentiated(
16331634
ai->getArgumentsWithoutIndirectResults().size(),
16341635
activeParamIndices));
16351636

1636-
// Check and diagnose non-differentiable original function type.
1637-
auto diagnoseNondifferentiableOriginalFunctionType =
1637+
// Check for non-differentiable original function type.
1638+
auto checkNondifferentiableOriginalFunctionType =
16381639
[&](CanSILFunctionType origFnTy) {
16391640
// Check and diagnose non-differentiable arguments.
1640-
for (unsigned paramIndex : range(origFnTy->getNumParameters())) {
1641+
for (unsigned paramIndex :
1642+
range(origFnTy->getNumParameters())) {
16411643
if (curIndices.isWrtParameter(paramIndex) &&
16421644
!origFnTy->getParameters()[paramIndex]
16431645
.getSILStorageType()
@@ -1653,23 +1655,25 @@ bool LinearMapInfo::shouldBeDifferentiated(
16531655
}
16541656
return false;
16551657
};
1656-
if (diagnoseNondifferentiableOriginalFunctionType(originalFnSubstTy))
1658+
if (checkNondifferentiableOriginalFunctionType(originalFnSubstTy))
16571659
continue;
16581660

1659-
auto assocFnType = originalFnSubstTy->getAutoDiffAssociatedFunctionType(
1660-
parameters, source,
1661-
/*differentiationOrder*/ 1, kind, builder.getModule(),
1662-
LookUpConformanceInModule(builder.getModule().getSwiftModule()));
1661+
auto assocFnType =
1662+
originalFnSubstTy->getAutoDiffAssociatedFunctionType(
1663+
parameters, source,
1664+
/*differentiationOrder*/ 1, kind, builder.getModule(),
1665+
LookUpConformanceInModule(
1666+
builder.getModule().getSwiftModule()));
16631667

16641668
auto assocFnResultTypes =
16651669
assocFnType->getAllResultsType().castTo<TupleType>();
1666-
assocFnResultTypes
1667-
->getElement(assocFnResultTypes->getElements().size() - 1);
1668-
auto linearMapSILType =
1669-
SILType::getPrimitiveObjectType(
1670-
assocFnResultTypes->getElement(
1671-
assocFnResultTypes->getElements().size() - 1)
1672-
.getType()->getCanonicalType());
1670+
assocFnResultTypes->getElement(
1671+
assocFnResultTypes->getElements().size() - 1);
1672+
auto linearMapSILType = SILType::getPrimitiveObjectType(
1673+
assocFnResultTypes
1674+
->getElement(assocFnResultTypes->getElements().size() - 1)
1675+
.getType()
1676+
->getCanonicalType());
16731677
addLinearMapDecl(ai, linearMapSILType);
16741678
}
16751679
}

0 commit comments

Comments
 (0)