Skip to content

Commit c717f48

Browse files
authored
Merge pull request #7485 from slavapestov/class-accessor-performance-regression
Fix recent class accessor performance regression
2 parents 912ad69 + 3231655 commit c717f48

18 files changed

+87
-56
lines changed

include/swift/AST/Decl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,11 @@ class alignas(1 << DeclAlignInBits) Decl {
511511
/// it is implicit. This bit is used during parsing and type-checking to
512512
/// control inserting the implicit destructor.
513513
unsigned HasDestructorDecl : 1;
514+
515+
/// Whether the class has @objc ancestry.
516+
unsigned ObjCClassKind : 3;
514517
};
515-
enum { NumClassDeclBits = NumNominalTypeDeclBits + 8 };
518+
enum { NumClassDeclBits = NumNominalTypeDeclBits + 11 };
516519
static_assert(NumClassDeclBits <= 32, "fits in an unsigned");
517520

518521
class StructDeclBitfields {

lib/AST/Decl.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,6 +2409,7 @@ ClassDecl::ClassDecl(SourceLoc ClassLoc, Identifier Name, SourceLoc NameLoc,
24092409
= static_cast<unsigned>(StoredInheritsSuperclassInits::Unchecked);
24102410
ClassDeclBits.RawForeignKind = 0;
24112411
ClassDeclBits.HasDestructorDecl = 0;
2412+
ClassDeclBits.ObjCClassKind = 0;
24122413
}
24132414

24142415
DestructorDecl *ClassDecl::getDestructor() {
@@ -2502,6 +2503,10 @@ bool ClassDecl::inheritsSuperclassInitializers(LazyResolver *resolver) {
25022503
}
25032504

25042505
ObjCClassKind ClassDecl::checkObjCAncestry() const {
2506+
// See if we've already computed this.
2507+
if (ClassDeclBits.ObjCClassKind)
2508+
return ObjCClassKind(ClassDeclBits.ObjCClassKind - 1);
2509+
25052510
llvm::SmallPtrSet<const ClassDecl *, 8> visited;
25062511
bool genericAncestry = false, isObjC = false;
25072512
const ClassDecl *CD = this;
@@ -2528,14 +2533,18 @@ ObjCClassKind ClassDecl::checkObjCAncestry() const {
25282533
break;
25292534
}
25302535

2536+
ObjCClassKind kind = ObjCClassKind::ObjC;
25312537
if (!isObjC)
2532-
return ObjCClassKind::NonObjC;
2533-
if (genericAncestry)
2534-
return ObjCClassKind::ObjCMembers;
2535-
if (CD == this || !CD->isObjC())
2536-
return ObjCClassKind::ObjCWithSwiftRoot;
2537-
2538-
return ObjCClassKind::ObjC;
2538+
kind = ObjCClassKind::NonObjC;
2539+
else if (genericAncestry)
2540+
kind = ObjCClassKind::ObjCMembers;
2541+
else if (CD == this || !CD->isObjC())
2542+
kind = ObjCClassKind::ObjCWithSwiftRoot;
2543+
2544+
// Save the result for later.
2545+
const_cast<ClassDecl *>(this)->ClassDeclBits.ObjCClassKind
2546+
= unsigned(kind) + 1;
2547+
return kind;
25392548
}
25402549

25412550
/// Mangle the name of a protocol or class for use in the Objective-C

lib/Sema/CodeSynthesis.cpp

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,31 @@ static void maybeMarkTransparent(FuncDecl *accessor,
262262
AbstractStorageDecl *storage,
263263
TypeChecker &TC) {
264264
auto *DC = storage->getDeclContext();
265-
if (isa<ProtocolDecl>(DC) || isa<ClassDecl>(DC))
265+
auto *nominalDecl = DC->getAsNominalTypeOrNominalTypeExtensionContext();
266+
267+
// Global variable accessors are not @_transparent.
268+
if (!nominalDecl)
269+
return;
270+
271+
// Accessors for stored properties of resilient types are not
272+
// @_transparent.
273+
if (!nominalDecl->hasFixedLayout())
274+
return;
275+
276+
// Accessors for protocol storage requirements are never @_transparent
277+
// since they do not have bodies.
278+
//
279+
// FIXME: Revisit this if we ever get 'real' default implementations.
280+
if (isa<ProtocolDecl>(nominalDecl))
266281
return;
267282

268-
auto *nominal = DC->getAsNominalTypeOrNominalTypeExtensionContext();
269-
if (nominal && nominal->hasFixedLayout())
270-
accessor->getAttrs().add(new (TC.Context) TransparentAttr(IsImplicit));
283+
// Accessors for classes with @objc ancestry are not @_transparent,
284+
// since they use a field offset variable which is not exported.
285+
if (auto *classDecl = dyn_cast<ClassDecl>(nominalDecl))
286+
if (classDecl->checkObjCAncestry() != ObjCClassKind::NonObjC)
287+
return;
288+
289+
accessor->getAttrs().add(new (TC.Context) TransparentAttr(IsImplicit));
271290
}
272291

273292
static FuncDecl *createMaterializeForSetPrototype(AbstractStorageDecl *storage,

test/SILGen/accessibility_warnings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ internal class InternalClass {
123123
// CHECK-DAG: sil hidden{{( \[.+\])*}} @_T022accessibility_warnings13InternalClassC9publicVarSifg
124124
public var publicVar = 0
125125

126-
// CHECK-DAG: sil hidden @_T022accessibility_warnings13InternalClassC19publicVarPrivateSetSifg
126+
// CHECK-DAG: sil hidden [transparent] @_T022accessibility_warnings13InternalClassC19publicVarPrivateSetSifg
127127
public private(set) var publicVarPrivateSet = 0
128128

129129
public public(set) var publicVarPublicSet = 0

test/SILGen/addressors.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class G {
306306
}
307307
}
308308
}
309-
// CHECK: sil hidden @_T010addressors1GC5values5Int32Vfg : $@convention(method) (@guaranteed G) -> Int32 {
309+
// CHECK: sil hidden [transparent] @_T010addressors1GC5values5Int32Vfg : $@convention(method) (@guaranteed G) -> Int32 {
310310
// CHECK: bb0([[SELF:%0]] : $G):
311311
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_T010addressors1GC5values5Int32Vflo : $@convention(method) (@guaranteed G) -> (UnsafePointer<Int32>, @owned Builtin.NativeObject)
312312
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
@@ -319,7 +319,7 @@ class G {
319319
// CHECK: strong_release [[OWNER]] : $Builtin.NativeObject
320320
// CHECK: return [[VALUE]] : $Int32
321321

322-
// CHECK: sil hidden @_T010addressors1GC5values5Int32Vfs : $@convention(method) (Int32, @guaranteed G) -> () {
322+
// CHECK: sil hidden [transparent] @_T010addressors1GC5values5Int32Vfs : $@convention(method) (Int32, @guaranteed G) -> () {
323323
// CHECK: bb0([[VALUE:%0]] : $Int32, [[SELF:%1]] : $G):
324324
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_T010addressors1GC5values5Int32Vfao : $@convention(method) (@guaranteed G) -> (UnsafeMutablePointer<Int32>, @owned Builtin.NativeObject)
325325
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
@@ -332,7 +332,7 @@ class G {
332332
// CHECK: strong_release [[OWNER]] : $Builtin.NativeObject
333333

334334
// materializeForSet for G.value
335-
// CHECK-LABEL: sil hidden @_T010addressors1GC5values5Int32Vfm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed G) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
335+
// CHECK-LABEL: sil hidden [transparent] @_T010addressors1GC5values5Int32Vfm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed G) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
336336
// CHECK: bb0([[BUFFER:%0]] : $Builtin.RawPointer, [[STORAGE:%1]] : $*Builtin.UnsafeValueBuffer, [[SELF:%2]] : $G):
337337
// Call the addressor.
338338
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_T010addressors1GC5values5Int32Vfao : $@convention(method) (@guaranteed G) -> (UnsafeMutablePointer<Int32>, @owned Builtin.NativeObject)
@@ -356,7 +356,7 @@ class G {
356356
// CHECK: return [[RESULT]]
357357

358358
// materializeForSet callback for G.value
359-
// CHECK-LABEL: sil hidden @_T010addressors1GC5values5Int32VfmytfU_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout G, @thick G.Type) -> () {
359+
// CHECK-LABEL: sil hidden [transparent] @_T010addressors1GC5values5Int32VfmytfU_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout G, @thick G.Type) -> () {
360360
// CHECK: bb0([[BUFFER:%0]] : $Builtin.RawPointer, [[STORAGE:%1]] : $*Builtin.UnsafeValueBuffer, [[SELF:%2]] : $*G, [[SELFTYPE:%3]] : $@thick G.Type):
361361
// CHECK: [[T0:%.*]] = project_value_buffer $Builtin.NativeObject in [[STORAGE]] : $*Builtin.UnsafeValueBuffer
362362
// CHECK: [[OWNER:%.*]] = load [[T0]]
@@ -426,7 +426,7 @@ class I {
426426
}
427427
}
428428
}
429-
// CHECK-LABEL: sil hidden @_T010addressors1IC5values5Int32Vfg : $@convention(method) (@guaranteed I) -> Int32 {
429+
// CHECK-LABEL: sil hidden [transparent] @_T010addressors1IC5values5Int32Vfg : $@convention(method) (@guaranteed I) -> Int32 {
430430
// CHECK: bb0([[SELF:%0]] : $I):
431431
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_T010addressors1IC5values5Int32Vflp : $@convention(method) (@guaranteed I) -> (UnsafePointer<Int32>, @owned Optional<Builtin.NativeObject>)
432432
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
@@ -439,7 +439,7 @@ class I {
439439
// CHECK: strong_unpin [[OWNER]] : $Optional<Builtin.NativeObject>
440440
// CHECK: return [[VALUE]] : $Int32
441441

442-
// CHECK-LABEL: sil hidden @_T010addressors1IC5values5Int32Vfs : $@convention(method) (Int32, @guaranteed I) -> () {
442+
// CHECK-LABEL: sil hidden [transparent] @_T010addressors1IC5values5Int32Vfs : $@convention(method) (Int32, @guaranteed I) -> () {
443443
// CHECK: bb0([[VALUE:%0]] : $Int32, [[SELF:%1]] : $I):
444444
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_T010addressors1IC5values5Int32VfaP : $@convention(method) (@guaranteed I) -> (UnsafeMutablePointer<Int32>, @owned Optional<Builtin.NativeObject>)
445445
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
@@ -451,7 +451,7 @@ class I {
451451
// CHECK: store [[VALUE]] to [[T2]] : $*Int32
452452
// CHECK: strong_unpin [[OWNER]] : $Optional<Builtin.NativeObject>
453453

454-
// CHECK-LABEL: sil hidden @_T010addressors1IC5values5Int32Vfm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed I) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
454+
// CHECK-LABEL: sil hidden [transparent] @_T010addressors1IC5values5Int32Vfm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed I) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
455455
// CHECK: bb0([[BUFFER:%0]] : $Builtin.RawPointer, [[STORAGE:%1]] : $*Builtin.UnsafeValueBuffer, [[SELF:%2]] : $I):
456456
// Call the addressor.
457457
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_T010addressors1IC5values5Int32VfaP : $@convention(method) (@guaranteed I) -> (UnsafeMutablePointer<Int32>, @owned Optional<Builtin.NativeObject>)
@@ -475,7 +475,7 @@ class I {
475475
// CHECK: return [[RESULT]]
476476

477477
// materializeForSet callback for I.value
478-
// CHECK-LABEL: sil hidden @_T010addressors1IC5values5Int32VfmytfU_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout I, @thick I.Type) -> () {
478+
// CHECK-LABEL: sil hidden [transparent] @_T010addressors1IC5values5Int32VfmytfU_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout I, @thick I.Type) -> () {
479479
// CHECK: bb0([[BUFFER:%0]] : $Builtin.RawPointer, [[STORAGE:%1]] : $*Builtin.UnsafeValueBuffer, [[SELF:%2]] : $*I, [[SELFTYPE:%3]] : $@thick I.Type):
480480
// CHECK: [[T0:%.*]] = project_value_buffer $Optional<Builtin.NativeObject> in [[STORAGE]] : $*Builtin.UnsafeValueBuffer
481481
// CHECK: [[OWNER:%.*]] = load [[T0]]

test/SILGen/dynamic.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ protocol Proto {
6868

6969
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3{{[_0-9a-zA-Z]*}}fcTo
7070
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC10objcMethod{{[_0-9a-zA-Z]*}}FTo
71-
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC8objcPropSifgTo
72-
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC8objcPropSifsTo
71+
// CHECK-LABEL: sil hidden [transparent] [thunk] @_T07dynamic3FooC8objcPropSifgTo
72+
// CHECK-LABEL: sil hidden [transparent] [thunk] @_T07dynamic3FooC8objcPropSifsTo
7373
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC9subscriptSis9AnyObject_p4objc_tcfgTo
7474
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC9subscriptSis9AnyObject_p4objc_tcfsTo
7575

@@ -81,8 +81,8 @@ protocol Proto {
8181

8282
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3{{[_0-9a-zA-Z]*}}fcTo
8383
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC0A6Method{{[_0-9a-zA-Z]*}}FTo
84-
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC0A4PropSifgTo
85-
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC0A4PropSifsTo
84+
// CHECK-LABEL: sil hidden [transparent] [thunk] @_T07dynamic3FooC0A4PropSifgTo
85+
// CHECK-LABEL: sil hidden [transparent] [thunk] @_T07dynamic3FooC0A4PropSifsTo
8686
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC9subscriptSiSiAA_tcfgTo
8787
// CHECK-LABEL: sil hidden [thunk] @_T07dynamic3FooC9subscriptSiSiAA_tcfsTo
8888

test/SILGen/guaranteed_self.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,15 @@ class C: Fooable, Barrable {
320320
self.bas()
321321
}
322322

323-
// CHECK-LABEL: sil hidden [thunk] @_T015guaranteed_self1CC5prop1SifgTo : $@convention(objc_method) (C) -> Int
323+
// CHECK-LABEL: sil hidden [transparent] [thunk] @_T015guaranteed_self1CC5prop1SifgTo : $@convention(objc_method) (C) -> Int
324324
// CHECK: bb0([[SELF:%.*]] : $C):
325325
// CHECK: [[SELF_COPY:%.*]] = copy_value [[SELF]]
326326
// CHECK: apply {{.*}}([[SELF_COPY]])
327327
// CHECK: destroy_value [[SELF_COPY]]
328328
// CHECK-NOT: destroy_value [[SELF]]
329329
// CHECK-NOT: destroy_value [[SELF_COPY]]
330330

331-
// CHECK-LABEL: sil hidden [thunk] @_T015guaranteed_self1CC5prop1SifsTo : $@convention(objc_method) (Int, C) -> ()
331+
// CHECK-LABEL: sil hidden [transparent] [thunk] @_T015guaranteed_self1CC5prop1SifsTo : $@convention(objc_method) (Int, C) -> ()
332332
// CHECK: bb0({{.*}} [[SELF:%.*]] : $C):
333333
// CHECK: [[SELF_COPY:%.*]] = copy_value [[SELF]]
334334
// CHECK: apply {{.*}} [[SELF_COPY]]

test/SILGen/materializeForSet.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Base {
66
// The ordering here is unfortunate: we generate the property
77
// getters and setters after we've processed the decl.
88

9-
// CHECK-LABEL: sil hidden @_T017materializeForSet4BaseC8computedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Base) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
9+
// CHECK-LABEL: sil hidden [transparent] @_T017materializeForSet4BaseC8computedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Base) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
1010
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $Base):
1111
// CHECK: [[ADDR:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to [strict] $*Int
1212
// CHECK: [[T0:%.*]] = function_ref @_T017materializeForSet4BaseC8computedSifg
@@ -20,15 +20,15 @@ class Base {
2020
// CHECK: return [[T4]] : $(Builtin.RawPointer, Optional<Builtin.RawPointer>)
2121
// CHECK: }
2222

23-
// CHECK-LABEL: sil hidden @_T017materializeForSet4BaseC8computedSifmytfU_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Base, @thick Base.Type) -> () {
23+
// CHECK-LABEL: sil hidden [transparent] @_T017materializeForSet4BaseC8computedSifmytfU_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Base, @thick Base.Type) -> () {
2424
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $*Base, [[SELFTYPE:%.*]] : $@thick Base.Type):
2525
// CHECK: [[T0:%.*]] = load_borrow [[SELF]]
2626
// CHECK: [[T1:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to [strict] $*Int
2727
// CHECK: [[T2:%.*]] = load [trivial] [[T1]] : $*Int
2828
// CHECK: [[SETTER:%.*]] = function_ref @_T017materializeForSet4BaseC8computedSifs
2929
// CHECK: apply [[SETTER]]([[T2]], [[T0]])
3030

31-
// CHECK-LABEL: sil hidden @_T017materializeForSet4BaseC6storedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Base) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
31+
// CHECK-LABEL: sil hidden [transparent] @_T017materializeForSet4BaseC6storedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Base) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
3232
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $Base):
3333
// CHECK: [[T0:%.*]] = ref_element_addr [[SELF]] : $Base, #Base.stored
3434
// CHECK: [[T1:%.*]] = address_to_pointer [[T0]] : $*Int to $Builtin.RawPointer
@@ -205,7 +205,7 @@ class HasDidSet : Base {
205205
didSet {}
206206
}
207207

208-
// CHECK-LABEL: sil hidden @_T017materializeForSet06HasDidC0C6storedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasDidSet) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
208+
// CHECK-LABEL: sil hidden [transparent] @_T017materializeForSet06HasDidC0C6storedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasDidSet) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
209209
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $HasDidSet):
210210
// CHECK: [[T2:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to [strict] $*Int
211211
// CHECK: [[T0:%.*]] = function_ref @_T017materializeForSet06HasDidC0C6storedSifg
@@ -224,7 +224,7 @@ class HasDidSet : Base {
224224
set(value) {}
225225
}
226226

227-
// CHECK-LABEL: sil hidden @_T017materializeForSet06HasDidC0C8computedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasDidSet) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
227+
// CHECK-LABEL: sil hidden [transparent] @_T017materializeForSet06HasDidC0C8computedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasDidSet) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
228228
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $HasDidSet):
229229
// CHECK: [[T2:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to [strict] $*Int
230230
// CHECK: [[T0:%.*]] = function_ref @_T017materializeForSet06HasDidC0C8computedSifg
@@ -244,7 +244,7 @@ class HasStoredDidSet {
244244
didSet {}
245245
}
246246

247-
// CHECK-LABEL: sil hidden @_T017materializeForSet012HasStoredDidC0C6storedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasStoredDidSet) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
247+
// CHECK-LABEL: sil hidden [transparent] @_T017materializeForSet012HasStoredDidC0C6storedSifm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasStoredDidSet) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
248248
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $HasStoredDidSet):
249249
// CHECK: [[T2:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to [strict] $*Int
250250
// CHECK: [[T0:%.*]] = function_ref @_T017materializeForSet012HasStoredDidC0C6storedSifg
@@ -259,7 +259,7 @@ class HasStoredDidSet {
259259
// CHECK: }
260260
}
261261

262-
// CHECK-LABEL: sil hidden @_T017materializeForSet012HasStoredDidC0C6storedSifmytfU_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout HasStoredDidSet, @thick HasStoredDidSet.Type) -> () {
262+
// CHECK-LABEL: sil hidden [transparent] @_T017materializeForSet012HasStoredDidC0C6storedSifmytfU_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout HasStoredDidSet, @thick HasStoredDidSet.Type) -> () {
263263
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $*HasStoredDidSet, [[METATYPE:%.*]] : $@thick HasStoredDidSet.Type):
264264
// CHECK: [[SELF_VALUE:%.*]] = load_borrow [[SELF]] : $*HasStoredDidSet
265265
// CHECK: [[BUFFER_ADDR:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to [strict] $*Int
@@ -272,7 +272,7 @@ class HasStoredDidSet {
272272
class HasWeak {
273273
weak var weakvar: HasWeak?
274274
}
275-
// CHECK-LABEL: sil hidden @_T017materializeForSet7HasWeakC7weakvarACSgXwfm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasWeak) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
275+
// CHECK-LABEL: sil hidden [transparent] @_T017materializeForSet7HasWeakC7weakvarACSgXwfm : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasWeak) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
276276
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $HasWeak):
277277
// CHECK: [[T2:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to [strict] $*Optional<HasWeak>
278278
// CHECK: [[T0:%.*]] = ref_element_addr [[SELF]] : $HasWeak, #HasWeak.weakvar
@@ -486,7 +486,7 @@ func inoutAccessOfLazyStructProperty(l: inout LazyStructProperty) {
486486

487487
// Test for materializeForSet vs lazy properties of classes.
488488

489-
// CHECK-LABEL: sil hidden @_T017materializeForSet17LazyClassPropertyC3catSifm
489+
// CHECK-LABEL: sil hidden [transparent] @_T017materializeForSet17LazyClassPropertyC3catSifm
490490

491491
class LazyClassProperty {
492492
lazy var cat: Int = 5

0 commit comments

Comments
 (0)