Skip to content

Commit 41d5e57

Browse files
authored
Merge pull request #35991 from rxwei/73791807-tbdgen-derivative-vtable-thunks
2 parents d9036c2 + 3c02dba commit 41d5e57

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

lib/SIL/IR/SILDeclRef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ std::string SILDeclRef::mangle(ManglingKind MKind) const {
701701
AutoDiffConfig silConfig(
702702
silParameterIndices, resultIndices,
703703
derivativeFunctionIdentifier->getDerivativeGenericSignature());
704-
return mangler.mangleAutoDiffDerivativeFunction(
704+
return mangler.mangleAutoDiffDerivativeFunction(
705705
asAutoDiffOriginalFunction().getAbstractFunctionDecl(),
706706
derivativeFunctionIdentifier->getKind(),
707707
silConfig);

lib/SILGen/SILGen.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,7 @@ class LLVM_LIBRARY_VISIBILITY SILGenModule : public ASTVisitor<SILGenModule> {
242242

243243
/// Get or create a derivative function vtable entry thunk for the given
244244
/// SILDeclRef and derivative function type.
245-
SILFunction *
246-
getOrCreateDerivativeVTableThunk(
245+
SILFunction *getOrCreateDerivativeVTableThunk(
247246
SILDeclRef derivativeFnRef, CanSILFunctionType derivativeFnTy);
248247

249248
/// Determine whether we need to emit an ivar destroyer for the given class.

lib/SILGen/SILGenThunk.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ SILFunction *SILGenModule::getOrCreateDerivativeVTableThunk(
418418
derivativeId->getDerivativeGenericSignature()),
419419
/*isVTableThunk*/ true);
420420
auto *thunk = builder.getOrCreateFunction(
421-
derivativeFnDecl, name, originalFnDeclRef.getLinkage(ForDefinition),
422-
constantTy, IsBare, IsTransparent, derivativeFnDeclRef.isSerialized(),
423-
IsNotDynamic, ProfileCounter(), IsThunk);
421+
derivativeFnDecl, name, SILLinkage::Private, constantTy, IsBare,
422+
IsTransparent, derivativeFnDeclRef.isSerialized(), IsNotDynamic,
423+
ProfileCounter(), IsThunk);
424424
if (!thunk->empty())
425425
return thunk;
426426

test/AutoDiff/SILGen/vtable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class SubSub: Sub {}
9797

9898
// Check vtable entry thunks.
9999

100-
// CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @$s6vtable5SuperC6methodyS2f_SftFTJVfSUUpSr : $@convention(method) (Float, Float, @guaranteed Super) -> (Float, @owned @callee_guaranteed (Float) -> Float) {
100+
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s6vtable5SuperC6methodyS2f_SftFTJVfSUUpSr : $@convention(method) (Float, Float, @guaranteed Super) -> (Float, @owned @callee_guaranteed (Float) -> Float) {
101101
// CHECK: bb0(%0 : $Float, %1 : $Float, %2 : @guaranteed $Super):
102102
// CHECK: %3 = function_ref @$s6vtable5SuperC6methodyS2f_SftF : $@convention(method) (Float, Float, @guaranteed Super) -> Float
103103
// CHECK: %4 = differentiable_function [parameters 0] [results 0] %3 : $@convention(method) (Float, Float, @guaranteed Super) -> Float

test/AutoDiff/TBD/derivative_symbols.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,22 @@ public protocol P: Differentiable {
9797
subscript(_ x: Float) -> Float { get set }
9898
}
9999

100-
/* FIXME(rdar://73791807): Enable the following tests once we've fixed TBDGen
101-
for derivative vtable entry thunks.
102100
public final class Class: Differentiable {
103101
var stored: Float
104102

105103
// Test initializer.
106-
@differentiable(reverse)
104+
// FIXME(rdar://74380324)
105+
// @differentiable(reverse)
107106
public init(_ x: Float) {
108107
stored = x
109108
}
110109

111110
// Test delegating initializer.
112-
@differentiable(reverse)
113-
public convenience init(blah x: Float) {
114-
self.init(x)
115-
}
111+
// FIXME(rdar://74380324)
112+
// @differentiable(reverse)
113+
// public convenience init(blah x: Float) {
114+
// self.init(x)
115+
// }
116116

117117
// Test method.
118118
public func method(_ x: Float, _ y: Float) -> Float { x }
@@ -149,4 +149,3 @@ public final class Class: Differentiable {
149149
// fatalError()
150150
// }
151151
}
152-
*/

0 commit comments

Comments
 (0)