Skip to content

Commit c641df2

Browse files
committed
[AutoDiff] NFC: gardening.
Fix file header comments.
1 parent fac70ef commit c641df2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/SILOptimizer/Transforms/DifferentiabilityWitnessDevirtualizer.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212
//
13-
// Devirtualized differentiability witnesses whose bodies are availabe, by
14-
// turning "differentiability_witness_function" instructions into "function_ref"
15-
// instructions referencing the appropriate function.
13+
// Devirtualizes `differentiability_witness_function` instructions into
14+
// `function_ref` instructions for differentiability witness definitions.
1615
//
1716
//===----------------------------------------------------------------------===//
1817

@@ -26,7 +25,7 @@ using namespace swift;
2625
namespace {
2726
class DifferentiabilityWitnessDevirtualizer : public SILFunctionTransform {
2827

29-
/// Returns true if and changes were made.
28+
/// Returns true if any changes were made.
3029
bool devirtualizeDifferentiabilityWitnessesInFunction(SILFunction &f);
3130

3231
/// The entry point to the transformation.
@@ -50,17 +49,17 @@ bool DifferentiabilityWitnessDevirtualizer::
5049
}
5150
}
5251
for (auto *inst : insts) {
53-
auto *wit = inst->getWitness();
54-
if (wit->isDeclaration())
55-
f.getModule().loadDifferentiabilityWitness(wit);
56-
if (wit->isDeclaration())
52+
auto *witness = inst->getWitness();
53+
if (witness->isDeclaration())
54+
f.getModule().loadDifferentiabilityWitness(witness);
55+
if (witness->isDeclaration())
5756
continue;
5857
changed = true;
5958
SILBuilderWithScope builder(inst);
6059
auto kind = inst->getWitnessKind().getAsDerivativeFunctionKind();
6160
assert(kind.hasValue());
6261
auto *newInst = builder.createFunctionRefFor(inst->getLoc(),
63-
wit->getDerivative(*kind));
62+
witness->getDerivative(*kind));
6463
inst->replaceAllUsesWith(newInst);
6564
inst->getParent()->erase(inst);
6665
}

0 commit comments

Comments
 (0)