Skip to content

Commit 4187700

Browse files
committed
AutoDiffIndexSubset -> IndexSubset
1 parent d75f6ce commit 4187700

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

include/swift/AST/AutoDiff.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ class AutoDiffDerivativeFunctionIdentifier : public llvm::FoldingSetNode {
243243
/// derivative generic signature.
244244
// TODO(TF-893): Unify with `AutoDiffDerivativeFunctionIdentifier`.
245245
using SILDifferentiabilityWitnessKey =
246-
std::tuple<StringRef, AutoDiffIndexSubset *,
247-
AutoDiffIndexSubset *, GenericSignature *>;
246+
std::tuple<StringRef, IndexSubset *, IndexSubset *, GenericSignature *>;
248247

249248
/// Automatic differentiation utility namespace.
250249
namespace autodiff {

include/swift/SIL/SILDifferentiabilityWitness.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ class SILDifferentiabilityWitness
4949
/// The original function.
5050
SILFunction *originalFunction;
5151
/// The parameter indices.
52-
AutoDiffIndexSubset *parameterIndices;
52+
IndexSubset *parameterIndices;
5353
/// The result indices.
54-
AutoDiffIndexSubset *resultIndices;
54+
IndexSubset *resultIndices;
5555
/// The derivative generic signature (optional).
5656
GenericSignature *derivativeGenericSignature;
5757
/// The JVP (Jacobian-vector products) derivative function.
@@ -64,8 +64,8 @@ class SILDifferentiabilityWitness
6464

6565
SILDifferentiabilityWitness(SILModule &module, SILLinkage linkage,
6666
SILFunction *originalFunction,
67-
AutoDiffIndexSubset *parameterIndices,
68-
AutoDiffIndexSubset *resultIndices,
67+
IndexSubset *parameterIndices,
68+
IndexSubset *resultIndices,
6969
GenericSignature *derivativeGenSig,
7070
SILFunction *jvp, SILFunction *vjp,
7171
bool isSerialized)
@@ -77,18 +77,18 @@ class SILDifferentiabilityWitness
7777
public:
7878
static SILDifferentiabilityWitness *create(
7979
SILModule &module, SILLinkage linkage, SILFunction *originalFunction,
80-
AutoDiffIndexSubset *parameterIndices, AutoDiffIndexSubset *resultIndices,
80+
IndexSubset *parameterIndices, IndexSubset *resultIndices,
8181
GenericSignature *derivativeGenSig, SILFunction *jvp, SILFunction *vjp,
8282
bool isSerialized);
8383

8484
SILDifferentiabilityWitnessKey getKey() const;
8585
SILModule &getModule() const { return module; }
8686
SILLinkage getLinkage() const { return linkage; }
8787
SILFunction *getOriginalFunction() const { return originalFunction; }
88-
AutoDiffIndexSubset *getParameterIndices() const {
88+
IndexSubset *getParameterIndices() const {
8989
return parameterIndices;
9090
}
91-
AutoDiffIndexSubset *getResultIndices() const {
91+
IndexSubset *getResultIndices() const {
9292
return resultIndices;
9393
}
9494
GenericSignature *getDerivativeGenericSignature() const {

lib/ParseSIL/ParseSIL.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6860,8 +6860,8 @@ bool SILParserTUState::parseSILDifferentiabilityWitness(Parser &P) {
68606860

68616861
SourceLoc lastLoc = P.getEndOfPreviousLoc();
68626862
// Parse an index subset, prefaced with the given label.
6863-
auto parseAutoDiffIndexSubset =
6864-
[&](StringRef label, AutoDiffIndexSubset *& paramIndexSubset) -> bool {
6863+
auto parseIndexSubset =
6864+
[&](StringRef label, IndexSubset *& indexSubset) -> bool {
68656865
if (P.parseSpecificIdentifier(
68666866
label, diag::sil_diff_witness_expected_keyword, label))
68676867
return true;
@@ -6892,16 +6892,16 @@ bool SILParserTUState::parseSILDifferentiabilityWitness(Parser &P) {
68926892
return true;
68936893
auto maxIndexRef =
68946894
std::max_element(paramIndices.begin(), paramIndices.end());
6895-
paramIndexSubset = AutoDiffIndexSubset::get(
6895+
indexSubset = IndexSubset::get(
68966896
P.Context, maxIndexRef ? *maxIndexRef + 1 : 0, paramIndices);
68976897
return false;
68986898
};
68996899
// Parse parameter and result indices.
6900-
AutoDiffIndexSubset *parameterIndices = nullptr;
6901-
AutoDiffIndexSubset *resultIndices = nullptr;
6902-
if (parseAutoDiffIndexSubset("parameters", parameterIndices))
6900+
IndexSubset *parameterIndices = nullptr;
6901+
IndexSubset *resultIndices = nullptr;
6902+
if (parseIndexSubset("parameters", parameterIndices))
69036903
return true;
6904-
if (parseAutoDiffIndexSubset("results", resultIndices))
6904+
if (parseIndexSubset("results", resultIndices))
69056905
return true;
69066906

69076907
// Parse a trailing 'where' clause (optional).

lib/SIL/SILDifferentiabilityWitness.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ using namespace swift;
1919

2020
SILDifferentiabilityWitness *SILDifferentiabilityWitness::create(
2121
SILModule &module, SILLinkage linkage, SILFunction *originalFunction,
22-
AutoDiffIndexSubset *parameterIndices, AutoDiffIndexSubset *resultIndices,
22+
IndexSubset *parameterIndices, IndexSubset *resultIndices,
2323
GenericSignature *derivativeGenSig, SILFunction *jvp, SILFunction *vjp,
2424
bool isSerialized) {
2525
void *buf = module.allocate(sizeof(SILDifferentiabilityWitness),

lib/Serialization/DeserializeSIL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3346,11 +3346,11 @@ SILDeserializer::readDifferentiabilityWitness(DeclID DId) {
33463346
assert(parameterAndResultIndices.size() ==
33473347
numParameterIndices + numResultIndices &&
33483348
"Parameter/result indices count mismatch");
3349-
auto *parameterIndices = AutoDiffIndexSubset::get(
3349+
auto *parameterIndices = IndexSubset::get(
33503350
MF->getContext(), original->getLoweredFunctionType()->getNumParameters(),
33513351
ArrayRef<unsigned>(parameterAndResultIndices)
33523352
.take_front(numParameterIndices));
3353-
auto *resultIndices = AutoDiffIndexSubset::get(
3353+
auto *resultIndices = IndexSubset::get(
33543354
MF->getContext(), original->getLoweredFunctionType()->getNumResults(),
33553355
ArrayRef<unsigned>(parameterAndResultIndices)
33563356
.take_back(numResultIndices));

0 commit comments

Comments
 (0)