Skip to content

Commit 1118fcd

Browse files
committed
Clean up.
1 parent 2c78e20 commit 1118fcd

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

lib/SILGen/SILGen.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,6 @@ void SILGenModule::emitDifferentiabilityWitness(
811811
};
812812
bool reorderSelf = shouldReorderSelf();
813813

814-
// Get or create differentiability witness.
815814
CanGenericSignature derivativeCanGenSig;
816815
if (auto *derivativeGenSig = config.derivativeGenericSignature)
817816
derivativeCanGenSig = derivativeGenSig->getCanonicalSignature();

lib/Serialization/SerializeSIL.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,7 +2322,7 @@ void SILSerializer::writeIndexTables() {
23222322
}
23232323

23242324
// SWIFT_ENABLE_TENSORFLOW
2325-
if (!DifferentiabilityWitnessOffset.empty()) {
2325+
if (!DifferentiabilityWitnessList.empty()) {
23262326
writeIndexTable(S, List,
23272327
sil_index_block::SIL_DIFFERENTIABILITY_WITNESS_NAMES,
23282328
DifferentiabilityWitnessList);
@@ -2542,17 +2542,12 @@ writeSILDifferentiabilityWitness(const SILDifferentiabilityWitness &dw) {
25422542
DifferentiabilityWitnessOffset.push_back(Out.GetCurrentBitNo());
25432543

25442544
auto *original = dw.getOriginalFunction();
2545-
addReferencedSILFunction(original, /*DeclOnly*/ true);
25462545
IdentifierID jvpID = 0;
25472546
IdentifierID vjpID = 0;
2548-
if (auto *jvp = dw.getJVP()) {
2549-
addReferencedSILFunction(jvp, /*DeclOnly*/ true);
2550-
jvpID = S.addUniquedStringRef(jvp->getName());
2551-
}
2552-
if (auto *vjp = dw.getVJP()) {
2553-
addReferencedSILFunction(vjp, /*DeclOnly*/ true);
2554-
vjpID = S.addUniquedStringRef(vjp->getName());
2555-
}
2547+
if (auto *jvp = dw.getJVP())
2548+
jvpID = addSILFunctionRef(jvp);
2549+
if (auto *vjp = dw.getVJP())
2550+
vjpID = addSILFunctionRef(vjp);
25562551
SmallVector<unsigned, 8> parameterAndResultIndices(
25572552
dw.getParameterIndices()->begin(), dw.getParameterIndices()->end());
25582553
parameterAndResultIndices.append(dw.getResultIndices()->begin(),
@@ -2569,7 +2564,7 @@ writeSILDifferentiabilityWitness(const SILDifferentiabilityWitness &dw) {
25692564

25702565
DifferentiabilityWitnessLayout::emitRecord(
25712566
Out, ScratchRecord, SILAbbrCodes[DifferentiabilityWitnessLayout::Code],
2572-
S.addUniquedStringRef(original->getName()),
2567+
addSILFunctionRef(original),
25732568
toStableSILLinkage(dw.getLinkage()),
25742569
dw.isSerialized(),
25752570
S.addGenericSignatureRef(dw.getDerivativeGenericSignature()),

0 commit comments

Comments
 (0)