@@ -73,25 +73,25 @@ void SILFunctionBuilder::addFunctionAttributes(SILFunction *F,
73
73
// - Non-getter accessors (setters, modifiers, etc).
74
74
// - Default argument generator functions.
75
75
// - Thunks. Those are currently handled in SILGenThunk.cpp.
76
- if ((!isa<AccessorDecl>(decl) || dyn_cast <AccessorDecl>(decl)->isGetter ()) &&
76
+ if ((!isa<AccessorDecl>(decl) || cast <AccessorDecl>(decl)->isGetter ()) &&
77
77
constant.kind != SILDeclRef::Kind::DefaultArgGenerator &&
78
78
!constant.autoDiffAssociatedFunctionIdentifier &&
79
+ !constant.isStoredPropertyInitializer () &&
79
80
!constant.isThunk ()) {
80
81
for (auto *A : Attrs.getAttributes <DifferentiableAttr>()) {
81
- auto *DA = cast<DifferentiableAttr>(A);
82
82
std::string jvpName, vjpName;
83
83
// Get JVP/VJP names.
84
- if (auto *jvpFn = DA ->getJVPFunction ())
84
+ if (auto *jvpFn = A ->getJVPFunction ())
85
85
jvpName = SILDeclRef (jvpFn).mangle ();
86
- if (auto *vjpFn = DA ->getVJPFunction ())
86
+ if (auto *vjpFn = A ->getVJPFunction ())
87
87
vjpName = SILDeclRef (vjpFn).mangle ();
88
88
// Get lowered argument indices.
89
- auto paramIndices = DA ->getParameterIndices ();
90
- auto loweredIndices = paramIndices->getLowered (
89
+ auto paramIndices = A ->getParameterIndices ();
90
+ auto loweredParamIndices = paramIndices->getLowered (
91
91
decl->getInterfaceType ()->castTo <AnyFunctionType>());
92
- SILAutoDiffIndices indices (/* source*/ 0 , loweredIndices );
92
+ SILAutoDiffIndices indices (/* source*/ 0 , loweredParamIndices );
93
93
auto silDiffAttr = SILDifferentiableAttr::create (
94
- M, indices, DA ->getRequirements (), M.allocateCopy (jvpName),
94
+ M, indices, A ->getRequirements (), M.allocateCopy (jvpName),
95
95
M.allocateCopy (vjpName));
96
96
F->addDifferentiableAttr (silDiffAttr);
97
97
}
0 commit comments