Turn on +0 self by default.

The only caveat is that:

1. We do not properly recognize when we have a let binding and we
perform a guaranteed dynamic call. In such a case, we add an extra
retain, release pair around the call. In order to get that case I will
need to refactor some code in Callee. I want to make this change, but
not at the expense of getting the rest of this work in.

2. Some of the protocol witness thunks generated have unnecessary
retains or releases in a similar manner.

But this is a good first step.

I am going to send a large follow up email with all of the relevant results, so
I can let the bots chew on this a little bit.

rdar://19933044

Swift SVN r27241
This commit is contained in:
Michael Gottesman
2015-04-12 22:23:37 +00:00
parent bffbc8f92f
commit 75ea31dba9
78 changed files with 517 additions and 381 deletions

View File

@@ -90,7 +90,7 @@ public:
bool EnableFuncSigOpts = true;
/// Should we emit self as a guaranteed parameter?
bool EnableGuaranteedSelf = false;
bool EnableGuaranteedSelf = true;
/// Instrument code to generate profiling information.
bool GenerateProfile = false;

View File

@@ -2719,6 +2719,20 @@ public:
}
}
bool hasGuaranteedSelfParam() const {
switch (getRepresentation()) {
case Representation::Thick:
case Representation::Block:
case Representation::Thin:
case Representation::CFunctionPointer:
case Representation::ObjCMethod:
return false;
case Representation::Method:
case Representation::WitnessMethod:
return true;
}
}
/// True if the function representation carries context.
bool hasContext() const {
switch (getRepresentation()) {

View File

@@ -2647,13 +2647,10 @@ public:
void verifySILFunctionType(CanSILFunctionType FTy) {
// Make sure that if FTy's calling convention implies that it must have a
// self parameter, it is not empty if we do not have canonical sil.
if (F.getModule().getStage() == SILStage::Raw &&
FTy->hasSelfParam()) {
require(!FTy->getParameters().empty(),
// self parameter.
require(!FTy->hasSelfParam() || !FTy->getParameters().empty(),
"Functions with a calling convention with self parameter must "
"have at least one argument for self.");
}
// Make sure that FTy does not have any out parameters except for the first
// parameter.
@@ -2784,6 +2781,40 @@ public:
SILVisitor::visitSILBasicBlock(BB);
}
void verifySILSelfParameterType(SILFunction *F, CanSILFunctionType FTy) {
SILModule &M = F->getModule();
SILParameterInfo PInfo = FTy->getSelfParameter();
CanType CTy = PInfo.getType();
SILType Ty = SILType::getPrimitiveObjectType(CTy);
// We do not care about trivial parameters (for now). There seem to be
// cases where we lower them as unowned.
//
// *NOTE* We do not run this check when we have a generic type since
// *generic types do not have type lowering and are always treated as
// *non-trivial since we do not know the type.
if (CTy->hasArchetype() || CTy->isDependentType() ||
M.getTypeLowering(Ty).isTrivial())
return;
// If we don't have a decl ref, return.
auto DeclRef = M.lookUpDeclRef(F);
if (!DeclRef)
return;
// If this function is a constructor or destructor, bail. These have @owned
// parameters.
if (DeclRef.getValue().isConstructor() || DeclRef.getValue().isDestructor())
return;
// Otherwise, if this function type has a guaranteed self parameter type,
// make sure that we have a +0 self param.
require(!FTy->getExtInfo().hasGuaranteedSelfParam() ||
PInfo.isGuaranteed() || PInfo.isIndirectInOut(),
"Function with guaranteed self, but self param is not "
"+0?!");
}
void visitSILFunction(SILFunction *F) {
PrettyStackTraceSILFunction stackTrace("verifying", F);
@@ -2802,6 +2833,13 @@ public:
CanSILFunctionType FTy = F->getLoweredFunctionType();
verifySILFunctionType(FTy);
// If this function has a self parameter, make sure that it has a +0 calling
// convention. This can not be done for general function types, since
// function_ref's SILFunctionTypes do not have archetypes associated with
// it.
if (F->getModule().getStage() == SILStage::Canonical && FTy->hasSelfParam())
verifySILSelfParameterType(F, FTy);
if (F->isExternalDeclaration()) {
assert(F->isAvailableExternally() &&
"external declaration of internal SILFunction not allowed");

View File

@@ -1643,8 +1643,13 @@ void SILGenFunction::emitProtocolWitness(ProtocolConformance *conformance,
if (selfInstanceType.getClassOrBoundGenericClass()) {
if (selfInstanceType != witnessInstanceType) {
SILValue upcast = B.createUpcast(loc, selfOrigParam.getValue(),
SILType::getPrimitiveObjectType(witnessType));
// Match the category of selfOrigParam. We leave the loading to
// TranslateArguments.
auto upcastCategory = selfOrigParam.getValue().getType().getCategory();
SILType upcastTy =
SILType::getPrimitiveType(witnessType, upcastCategory);
SILValue upcast =
B.createUpcast(loc, selfOrigParam.getValue(), upcastTy);
selfOrigParam = ManagedValue(upcast, selfOrigParam.getCleanup());
}
} else {

View File

@@ -1053,10 +1053,15 @@ void LifetimeChecker::handleLoadUseFailure(const DIMemoryUse &Use,
}
}
// If the upcast is used by a class_method + apply, then this is a call of
// a superclass method or property accessor.
// If the upcast is used by a class_method + apply, then this is a call of a
// superclass method or property accessor. If we have a guaranteed method,
// we will have a release due to a missing optimization in SILGen that will
// be removed.
//
// TODO: Implement the SILGen fixes so this can be removed.
ClassMethodInst *CMI = nullptr;
ApplyInst *AI = nullptr;
SILInstruction *Release = nullptr;
for (auto UI : SILValue(UCI, 0).getUses()) {
auto *User = UI->getUser();
if (auto *TAI = dyn_cast<ApplyInst>(User)) {
@@ -1072,12 +1077,27 @@ void LifetimeChecker::handleLoadUseFailure(const DIMemoryUse &Use,
}
}
if (isa<ReleaseValueInst>(User) || isa<StrongReleaseInst>(User)) {
if (!Release) {
Release = User;
continue;
}
}
// Not a pattern we recognize, conservatively generate a generic
// diagnostic.
CMI = nullptr;
break;
}
// If we have a release, make sure that AI is guaranteed. If it is not, emit
// the generic error that we would emit before.
//
// That is the only case where we support pattern matching a release.
if (Release &&
!AI->getSubstCalleeType()->getExtInfo().hasGuaranteedSelfParam())
CMI = nullptr;
if (AI && CMI) {
// TODO: Could handle many other members more specifically.
auto *Decl = CMI->getMember().getDecl();

View File

@@ -14,6 +14,7 @@ class A {
// CHECK: sil hidden @_TToFC8optional1A3foofS0_FT_GSqSS_ : $@cc(objc_method) @thin (A) -> @autoreleased Optional<NSString>
// CHECK: [[T0:%.*]] = function_ref @_TFC8optional1A3foofS0_FT_GSqSS_
// CHECK-NEXT: [[T1:%.*]] = apply [[T0]](%0)
// CHECK-NEXT: strong_release
// CHECK-NEXT: [[TMP_OPTNSSTR:%.*]] = alloc_stack $Optional<NSString>
// CHECK-NEXT: [[TMP_OPTSTR:%.*]] = alloc_stack $Optional<String>
// CHECK-NEXT: store [[T1]] to [[TMP_OPTSTR]]#1
@@ -64,6 +65,7 @@ class A {
// CHECK-NEXT: dealloc_stack [[TMP_OPTSTR]]
// CHECK: [[T1:%.*]] = function_ref @_TFC8optional1A3barfS0_FT1xGSqSS__T_
// CHECK-NEXT: [[T2:%.*]] = apply [[T1]]([[T0]], %1)
// CHECK-NEXT: strong_release %1
// CHECK-NEXT: return [[T2]] : $()
}

View File

@@ -36,6 +36,7 @@ func main(x: Int) -> Void
{
var result = my_class.do_something(x)
print ("Here is something you might consider doing: \(result).\n")
// CHECK: call {{.*}} @swift_release {{.*}}
// CHECK: call {{.*}} @swift_release {{.*}}, !dbg ![[CLOSURE_END:.*]]
// CHECK-NEXT: ret void, !dbg ![[CLOSURE_END]]
// CHECK: ![[CLOSURE_END]] = !MDLocation(line: [[@LINE+1]],

View File

@@ -12,7 +12,6 @@ public func ifelseexpr() -> Int {
// CHECK: [[X:%.*]] = call %C6return1X* @_TFC6return1XCfMS0_FT1iSi_S0_(i{{32|64}} 0, %swift.type* [[META]])
// CHECK: @swift_release to void (%C6return1X*)*)(%C6return1X* [[X]])
if true {
// CHECK: @swift_release to void (%C6return1X*)*)(%C6return1X* [[X]])
x.x++;
} else {
x.x--;

View File

@@ -120,7 +120,7 @@ bb0(%0 : $D):
return %1 : $()
}
sil hidden @_TFC5class1D8multiplyfS0_fT1xBi8__FT1yBi16__Bi32_ : $@cc(method) @thin (Builtin.Int16, Builtin.Int8, @owned D) -> Builtin.Int32 {
sil hidden @_TFC5class1D8multiplyfS0_fT1xBi8__FT1yBi16__Bi32_ : $@cc(method) @thin (Builtin.Int16, Builtin.Int8, @guaranteed D) -> Builtin.Int32 {
bb0(%0 : $Builtin.Int16, %1 : $Builtin.Int8, %2 : $D):
%3 = integer_literal $Builtin.Int32, 0
return %3 : $Builtin.Int32

View File

@@ -93,7 +93,6 @@ func class_bounded_archetype_method<T : ClassBoundBinary>(x: T, y: T) {
x.classBoundBinaryMethod(y)
// CHECK: [[WITNESS_ENTRY:%.*]] = getelementptr inbounds i8*, i8** %T.ClassBoundBinary, i32 1
// CHECK: [[WITNESS:%.*]] = load i8*, i8** [[WITNESS_ENTRY]], align 8
// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_unknownRetain to void (%objc_object*)*)(%objc_object* %0)
// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_unknownRetain to void (%objc_object*)*)(%objc_object* [[Y:%.*]])
// CHECK: [[WITNESS_FUNC:%.*]] = bitcast i8* [[WITNESS]] to void (%objc_object*, %objc_object*, %swift.type*)
// CHECK: call void [[WITNESS_FUNC]](%objc_object* [[Y]], %objc_object* %0, %swift.type* {{.*}})

View File

@@ -24,8 +24,8 @@ sil_vtable Purebred {}
// CHECK: getelementptr inbounds {{.*}} [[VTABLE]]
sil @purebred_method : $@thin (@owned Purebred) -> () {
entry(%0 : $Purebred):
%m = class_method %0 : $Purebred, #Purebred.method!1 : Purebred -> () -> (), $@cc(method) @thin (@owned Purebred) -> ()
%z = apply %m(%0) : $@cc(method) @thin (@owned Purebred) -> ()
%m = class_method %0 : $Purebred, #Purebred.method!1 : Purebred -> () -> (), $@cc(method) @thin (@guaranteed Purebred) -> ()
%z = apply %m(%0) : $@cc(method) @thin (@guaranteed Purebred) -> ()
return %z : $()
}
@@ -48,8 +48,8 @@ sil_vtable Mongrel {}
// CHECK: getelementptr inbounds {{.*}} [[VTABLE]]
sil @mongrel_method : $@thin (@owned Mongrel) -> () {
entry(%0 : $Mongrel):
%m = class_method %0 : $Mongrel, #Mongrel.method!1 : Mongrel -> () -> (), $@cc(method) @thin (@owned Mongrel) -> ()
%z = apply %m(%0) : $@cc(method) @thin (@owned Mongrel) -> ()
%m = class_method %0 : $Mongrel, #Mongrel.method!1 : Mongrel -> () -> (), $@cc(method) @thin (@guaranteed Mongrel) -> ()
%z = apply %m(%0) : $@cc(method) @thin (@guaranteed Mongrel) -> ()
return %z : $()
}

View File

@@ -14,8 +14,6 @@ class CustomDeallocator {
// CHECK: define hidden void @_TFC10deallocate17CustomDeallocatorD([[CD:%.*]]*
// CHECK: [[T0:%.*]] = call [[OBJECT:%.*]]* @_TFC10deallocate17CustomDeallocatord(
// CHECK-NEXT: [[T1:%.*]] = bitcast [[OBJECT]]* [[T0]] to [[CD]]*
// CHECK-NEXT: [[T2:%.*]] = bitcast [[CD]]* [[T1]] to [[OBJECT]]*
// CHECK-NEXT: call void @swift_retain_noresult([[OBJECT]]* [[T2]])
// CHECK-NEXT: [[T3:%.*]] = call { i64, i64 } @_TFC10deallocate17CustomDeallocator29__getInstanceSizeAndAlignMaskfS0_FT_TSiSi_([[CD]]* [[T1]])
// CHECK-NEXT: [[SIZE:%.*]] = extractvalue { i64, i64 } [[T3]], 0
// CHECK-NEXT: [[ALIGNMASK:%.*]] = extractvalue { i64, i64 } [[T3]], 1

View File

@@ -23,6 +23,5 @@ class C {
// CHECK: store i64 0, i64* [[CAST1]], align 8
// CHECK: [[CAST2:%[a-zA-Z0-9]+]] = bitcast [[TYPE]]* [[ALLOCA]] to i64*
// CHECK: [[LOAD:%[a-zA-Z0-9]+]] = load i64, i64* [[CAST2]], align 8
// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%C21dynamic_self_metadata1C*)*)(%C21dynamic_self_metadata1C* %0)
// CHECK: ret i64 [[LOAD]]
}

View File

@@ -22,7 +22,7 @@ class ParentNode : Node {
}
// pic_crash.Node.init (pic_crash.Node.Type)(index : Swift.Int) -> pic_crash.Node
sil @_TFC9pic_crash4Node5checkfS0_FT_Si : $@cc(method) @thin (@owned Node) -> Int {
sil @_TFC9pic_crash4Node5checkfS0_FT_Si : $@cc(method) @thin (@guaranteed Node) -> Int {
bb0(%0 : $Node):
//CHECK-LABEL: @_TFC9pic_crash4Node5checkfS0_FT_Si
//CHECK: load %swift.type
@@ -42,12 +42,12 @@ bb3: // Preds: bb0
sil @_TFC9pic_crash4NodecfMS0_FT5indexSi_S0_ : $@cc(method) @thin (Int, @owned Node) -> @owned Node
sil @_TFC9pic_crash4NodeCfMS0_FT5indexSi_S0_ : $@thin (Int, @thick Node.Type) -> @owned Node
sil [transparent] @_TFC9pic_crash4Nodeg5indexSi : $@cc(method) @thin (@owned Node) -> Int
sil [transparent] @_TFC9pic_crash4Nodes5indexSi : $@cc(method) @thin (Int, @owned Node) -> ()
sil [transparent] @_TFC9pic_crash4Nodeg5indexSi : $@cc(method) @thin (@guaranteed Node) -> Int
sil [transparent] @_TFC9pic_crash4Nodes5indexSi : $@cc(method) @thin (Int, @guaranteed Node) -> ()
sil @_TFC9pic_crash10ParentNodecfMS0_FT4leftCS_4Node5rightS1_5indexSi_S0_ : $@cc(method) @thin (@owned Node, @owned Node, Int, @owned ParentNode) -> @owned ParentNode
sil @_TFC9pic_crash10ParentNodeCfMS0_FT4leftCS_4Node5rightS1_5indexSi_S0_ : $@thin (@owned Node, @owned Node, Int, @thick ParentNode.Type) -> @owned ParentNode
sil @_TFC9pic_crash10ParentNoded : $@cc(method) @thin (@owned ParentNode) -> @owned Builtin.NativeObject
sil @_TFC9pic_crash10ParentNodeD : $@cc(method) @thin (@owned ParentNode) -> ()
sil @_TFC9pic_crash10ParentNoded : $@cc(method) @thin (@guaranteed ParentNode) -> @owned Builtin.NativeObject
sil @_TFC9pic_crash10ParentNodeD : $@cc(method) @thin (@guaranteed ParentNode) -> ()
sil @_TFC9pic_crash10ParentNodecfMS0_FT5indexSi_S0_ : $@cc(method) @thin (Int, @owned ParentNode) -> @owned ParentNode
sil @_TFC9pic_crash10ParentNodeCfMS0_FT5indexSi_S0_ : $@thin (Int, @thick ParentNode.Type) -> @owned ParentNode

View File

@@ -24,9 +24,9 @@ sil @_TFC4main4HashcfMS0_FT_S0_ : $@cc(method) @thin (@owned Hash) -> @owned Has
sil @_TFC4main4HashCfMS0_FT_S0_ : $@thin (@thick Hash.Type) -> @owned Hash
// main.Hash.update (main.Hash)() -> ()
sil @_TFC4main4Hash6updatefS0_FT_T_ : $@cc(method) @thin (@owned Hash) -> () {
sil @_TFC4main4Hash6updatefS0_FT_T_ : $@cc(method) @thin (@guaranteed Hash) -> () {
bb0(%0 : $Hash):
%1 = class_method %0 : $Hash, #Hash.hash!1 : Hash -> () -> () , $@cc(method) @thin (@owned Hash) -> () // user: %9
%1 = class_method %0 : $Hash, #Hash.hash!1 : Hash -> () -> () , $@cc(method) @thin (@guaranteed Hash) -> () // user: %9
checked_cast_br [exact] %0 : $Hash to $MD5, bb2, bb3 // id: %2
bb1: // Preds: bb2 bb3
@@ -34,16 +34,14 @@ bb1: // Preds: bb2 bb3
return %3 : $() // id: %4
bb2(%5 : $MD5): // Preds: bb0
%6 = upcast %5 : $MD5 to $Hash // user: %7
strong_release %6 : $Hash // id: %7
br bb1 // id: %8
bb3: // Preds: bb0
%9 = apply %1(%0) : $@cc(method) @thin (@owned Hash) -> ()
%9 = apply %1(%0) : $@cc(method) @thin (@guaranteed Hash) -> ()
br bb1 // id: %10
}
sil @_TFC4main4Hash4hashfS0_FT_T_ : $@cc(method) @thin (@owned Hash) -> ()
sil @_TFC4main4Hash4hashfS0_FT_T_ : $@cc(method) @thin (@guaranteed Hash) -> ()
sil @_TFC4main4Hashd : $@cc(method) @thin (@owned Hash) -> @owned Builtin.NativeObject
sil @_TFC4main4HashD : $@cc(method) @thin (@owned Hash) -> ()
sil @_TFC4main3MD5cfMS0_FT_S0_ : $@cc(method) @thin (@owned MD5) -> @owned MD5

View File

@@ -124,11 +124,11 @@ class RootGeneric<T> {
}
sil @_TFC15generic_classes11RootGenericD : $@cc(method) @thin <T> (RootGeneric<T>) -> ()
sil @_TFC15generic_classes11RootGeneric3fooU__fGS0_Q__FT_T_ : $@cc(method) @thin <T> (@owned RootGeneric<T>) -> ()
sil @_TFC15generic_classes11RootGeneric3fooU__fGS0_Q__FT_T_ : $@cc(method) @thin <T> (@guaranteed RootGeneric<T>) -> ()
sil @_TFC15generic_classes11RootGeneric3barU__fGS0_Q__FT_T_ : $@cc(method) @thin <T> (@owned RootGeneric<T>) -> ()
sil @_TFC15generic_classes11RootGeneric3barU__fGS0_Q__FT_T_ : $@cc(method) @thin <T> (@guaranteed RootGeneric<T>) -> ()
sil @_TFC15generic_classes11RootGeneric3basU__fGS0_Q__FT_T_ : $@cc(method) @thin <T> (@owned RootGeneric<T>) -> ()
sil @_TFC15generic_classes11RootGeneric3basU__fGS0_Q__FT_T_ : $@cc(method) @thin <T> (@guaranteed RootGeneric<T>) -> ()
sil_vtable RootGeneric {
#RootGeneric.foo!1: _TFC15generic_classes11RootGeneric3fooU__fGS0_Q__FT_T_
@@ -167,11 +167,11 @@ class GenericInheritsGeneric<A, B> : RootGeneric<A> {
}
sil @_TFC15generic_classes22GenericInheritsGenericD : $@cc(method) @thin <T,U> (GenericInheritsGeneric<T,U>) -> ()
sil @_TFC15generic_classes22GenericInheritsGeneric7zippityU___fGS0_Q_Q0__FT_T_ : $@cc(method) @thin <A, B> (@owned GenericInheritsGeneric<A, B>) -> ()
sil @_TFC15generic_classes22GenericInheritsGeneric7zippityU___fGS0_Q_Q0__FT_T_ : $@cc(method) @thin <A, B> (@guaranteed GenericInheritsGeneric<A, B>) -> ()
sil @_TFC15generic_classes22GenericInheritsGeneric3dooU___fGS0_Q_Q0__FT_T_ : $@cc(method) @thin <A, B> (@owned GenericInheritsGeneric<A, B>) -> ()
sil @_TFC15generic_classes22GenericInheritsGeneric3dooU___fGS0_Q_Q0__FT_T_ : $@cc(method) @thin <A, B> (@guaranteed GenericInheritsGeneric<A, B>) -> ()
sil @_TFC15generic_classes22GenericInheritsGeneric3dahU___fGS0_Q_Q0__FT_T_ : $@cc(method) @thin <A, B> (@owned GenericInheritsGeneric<A, B>) -> ()
sil @_TFC15generic_classes22GenericInheritsGeneric3dahU___fGS0_Q_Q0__FT_T_ : $@cc(method) @thin <A, B> (@guaranteed GenericInheritsGeneric<A, B>) -> ()
sil_vtable GenericInheritsGeneric {
#RootGeneric.foo!1: _TFC15generic_classes11RootGeneric3fooU__fGS0_Q__FT_T_

View File

@@ -217,7 +217,7 @@ bb0:
%O = unchecked_ref_cast %C : $C to $Builtin.UnknownObject
// CHECK: class_method {{.*}} : $C, #C.doIt!1
%2 = class_method %C : $C, #C.doIt!1 : C -> () -> () , $@cc(method) @thin (@owned C) -> ()
%2 = class_method %C : $C, #C.doIt!1 : C -> () -> () , $@cc(method) @thin (@guaranteed C) -> ()
// CHECK: alloc_ref $D
%D = alloc_ref $D

View File

@@ -1,7 +1,7 @@
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: %target-swift-frontend -emit-module -sil-serialize-all -o %t %S/Inputs/def_generic.swift
// RUN: %target-sil-opt -linker -I %t %s | FileCheck %s
// RUN: %target-sil-opt -enable-guaranteed-self -linker -I %t %s | FileCheck %s
// Make sure that SILFunctionType with GenericSignature can match up with
// SILFunctionType deserialized from module.
@@ -16,11 +16,11 @@ import Swift
// CHECK: function_ref @_TFC11def_generic1A23convertFromArrayLiteralU__fGS0_Q__FtGSaQ___GS0_Q__
sil @top_level_code : $@thin () -> () {
bb0:
%3 = function_ref @_TFC11def_generic1A23convertFromArrayLiteralU__fGS0_Q__FtGSaQ___GS0_Q__ : $@cc(method) @thin <T> (@owned Array<T>, @owned A<T>) -> @owned A<T>
%3 = function_ref @_TFC11def_generic1A23convertFromArrayLiteralU__fGS0_Q__FtGSaQ___GS0_Q__ : $@cc(method) @thin <T> (@owned Array<T>, @guaranteed A<T>) -> @owned A<T>
%0 = tuple () // user: %1
return %0 : $() // id: %1
}
// Make sure the function body is deserialized.
// CHECK-LABEL: @_TFC11def_generic1A23convertFromArrayLiteralU__fGS0_Q__FtGSaQ___GS0_Q__ : $@cc(method) @thin <T> (@owned Array<T>, @owned A<T>) -> @owned A<T> {
sil @_TFC11def_generic1A23convertFromArrayLiteralU__fGS0_Q__FtGSaQ___GS0_Q__ : $@cc(method) @thin <T> (@owned Array<T>, @owned A<T>) -> @owned A<T>
// CHECK-LABEL: @_TFC11def_generic1A23convertFromArrayLiteralU__fGS0_Q__FtGSaQ___GS0_Q__ : $@cc(method) @thin <T> (@owned Array<T>, @guaranteed A<T>) -> @owned A<T> {
sil @_TFC11def_generic1A23convertFromArrayLiteralU__fGS0_Q__FtGSaQ___GS0_Q__ : $@cc(method) @thin <T> (@owned Array<T>, @guaranteed A<T>) -> @owned A<T>

View File

@@ -35,7 +35,6 @@ func test0(ref: A) {
// CHECK-NEXT: [[INDEX1:%.*]] = apply [[T0]]()
// Formal access to RHS.
// CHECK-NEXT: [[TEMP:%.*]] = alloc_stack $OrdinarySub
// CHECK-NEXT: strong_retain %0
// CHECK-NEXT: [[T0:%.*]] = class_method %0 : $A, #A.array!getter.1
// CHECK-NEXT: [[T1:%.*]] = apply [[T0]](%0)
// CHECK-NEXT: store [[T1]] to [[TEMP]]
@@ -43,10 +42,10 @@ func test0(ref: A) {
// CHECK-NEXT: // function_ref accessors.OrdinarySub.subscript.getter (Swift.Int) -> Swift.Int
// CHECK-NEXT: [[T1:%.*]] = function_ref @_TFV9accessors11OrdinarySubg9subscriptFSiSi
// CHECK-NEXT: [[VALUE:%.*]] = apply [[T1]]([[INDEX1]], [[T0]])
// CHECK-NEXT: release_value [[T0]]
// Formal access to LHS.
// CHECK-NEXT: [[STORAGE:%.*]] = alloc_stack $Builtin.UnsafeValueBuffer
// CHECK-NEXT: [[BUFFER:%.*]] = alloc_stack $OrdinarySub
// CHECK-NEXT: strong_retain %0
// CHECK-NEXT: [[T0:%.*]] = address_to_pointer [[BUFFER]]
// CHECK-NEXT: [[T1:%.*]] = class_method %0 : $A, #A.array!materializeForSet.1
// CHECK-NEXT: [[T2:%.*]] = apply [[T1]]([[T0]], [[STORAGE]]#1, %0)
@@ -102,7 +101,6 @@ func test1(ref: B) {
// Formal access to RHS.
// CHECK-NEXT: [[STORAGE:%.*]] = alloc_stack $Builtin.UnsafeValueBuffer
// CHECK-NEXT: [[BUFFER:%.*]] = alloc_stack $MutatingSub
// CHECK-NEXT: strong_retain %0
// CHECK-NEXT: [[T0:%.*]] = address_to_pointer [[BUFFER]]
// CHECK-NEXT: [[T1:%.*]] = class_method %0 : $B, #B.array!materializeForSet.1
// CHECK-NEXT: [[T2:%.*]] = apply [[T1]]([[T0]], [[STORAGE]]#1, %0)
@@ -126,7 +124,6 @@ func test1(ref: B) {
// Formal access to LHS.
// CHECK-NEXT: [[STORAGE2:%.*]] = alloc_stack $Builtin.UnsafeValueBuffer
// CHECK-NEXT: [[BUFFER2:%.*]] = alloc_stack $MutatingSub
// CHECK-NEXT: strong_retain %0
// CHECK-NEXT: [[T0:%.*]] = address_to_pointer [[BUFFER2]]
// CHECK-NEXT: [[T1:%.*]] = class_method %0 : $B, #B.array!materializeForSet.1
// CHECK-NEXT: [[T2:%.*]] = apply [[T1]]([[T0]], [[STORAGE2]]#1, %0)

View File

@@ -263,16 +263,15 @@ class F {
}
}
// CHECK: sil hidden @_TFC10addressors1Flo5valueVSs5Int32 : $@cc(method) @thin (@owned F) -> @owned (UnsafePointer<Int32>, Builtin.NativeObject) {
// CHECK: sil hidden @_TFC10addressors1Fao5valueVSs5Int32 : $@cc(method) @thin (@owned F) -> @owned (UnsafeMutablePointer<Int32>, Builtin.NativeObject) {
// CHECK: sil hidden @_TFC10addressors1Flo5valueVSs5Int32 : $@cc(method) @thin (@guaranteed F) -> @owned (UnsafePointer<Int32>, Builtin.NativeObject) {
// CHECK: sil hidden @_TFC10addressors1Fao5valueVSs5Int32 : $@cc(method) @thin (@guaranteed F) -> @owned (UnsafeMutablePointer<Int32>, Builtin.NativeObject) {
func test_f0(f: F) -> Int32 {
return f.value
}
// CHECK: sil hidden @_TF10addressors7test_f0FCS_1FVSs5Int32 : $@thin (@owned F) -> Int32 {
// CHECK: bb0([[SELF:%0]] : $F):
// CHECK: strong_retain [[SELF]] : $F
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Flo5valueVSs5Int32 : $@cc(method) @thin (@owned F) -> @owned (UnsafePointer<Int32>, Builtin.NativeObject)
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Flo5valueVSs5Int32 : $@cc(method) @thin (@guaranteed F) -> @owned (UnsafePointer<Int32>, Builtin.NativeObject)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[PTR:%.*]] = tuple_extract [[T0]] : $(UnsafePointer<Int32>, Builtin.NativeObject), 0
// CHECK: [[OWNER:%.*]] = tuple_extract [[T0]] : $(UnsafePointer<Int32>, Builtin.NativeObject), 1
@@ -291,8 +290,7 @@ func test_f1(f: F) {
// CHECK: bb0([[SELF:%0]] : $F):
// CHECK: [[T0:%.*]] = integer_literal $Builtin.Int32, 14
// CHECK: [[VALUE:%.*]] = struct $Int32 ([[T0]] : $Builtin.Int32)
// CHECK: strong_retain [[SELF]] : $F
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Fao5valueVSs5Int32 : $@cc(method) @thin (@owned F) -> @owned (UnsafeMutablePointer<Int32>, Builtin.NativeObject)
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Fao5valueVSs5Int32 : $@cc(method) @thin (@guaranteed F) -> @owned (UnsafeMutablePointer<Int32>, Builtin.NativeObject)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[PTR:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Builtin.NativeObject), 0
// CHECK: [[OWNER:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Builtin.NativeObject), 1
@@ -315,10 +313,9 @@ class G {
}
}
}
// CHECK: sil hidden [transparent] @_TFC10addressors1Gg5valueVSs5Int32 : $@cc(method) @thin (@owned G) -> Int32 {
// CHECK: sil hidden [transparent] @_TFC10addressors1Gg5valueVSs5Int32 : $@cc(method) @thin (@guaranteed G) -> Int32 {
// CHECK: bb0([[SELF:%0]] : $G):
// CHECK: strong_retain [[SELF]]
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Glo5valueVSs5Int32 : $@cc(method) @thin (@owned G) -> @owned (UnsafePointer<Int32>, Builtin.NativeObject)
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Glo5valueVSs5Int32 : $@cc(method) @thin (@guaranteed G) -> @owned (UnsafePointer<Int32>, Builtin.NativeObject)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[PTR:%.*]] = tuple_extract [[T0]] : $(UnsafePointer<Int32>, Builtin.NativeObject), 0
// CHECK: [[OWNER:%.*]] = tuple_extract [[T0]] : $(UnsafePointer<Int32>, Builtin.NativeObject), 1
@@ -327,13 +324,11 @@ class G {
// CHECK: [[T2:%.*]] = mark_dependence [[T1]] : $*Int32 on [[OWNER]] : $Builtin.NativeObject
// CHECK: [[VALUE:%.*]] = load [[T2]] : $*Int32
// CHECK: strong_release [[OWNER]] : $Builtin.NativeObject
// CHECK: strong_release [[SELF]] : $G
// CHECK: return [[VALUE]] : $Int32
// CHECK: sil hidden [transparent] @_TFC10addressors1Gs5valueVSs5Int32 : $@cc(method) @thin (Int32, @owned G) -> () {
// CHECK: sil hidden [transparent] @_TFC10addressors1Gs5valueVSs5Int32 : $@cc(method) @thin (Int32, @guaranteed G) -> () {
// CHECK: bb0([[VALUE:%0]] : $Int32, [[SELF:%1]] : $G):
// CHECK: strong_retain [[SELF]] : $G
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Gao5valueVSs5Int32 : $@cc(method) @thin (@owned G) -> @owned (UnsafeMutablePointer<Int32>, Builtin.NativeObject)
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Gao5valueVSs5Int32 : $@cc(method) @thin (@guaranteed G) -> @owned (UnsafeMutablePointer<Int32>, Builtin.NativeObject)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[PTR:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Builtin.NativeObject), 0
// CHECK: [[OWNER:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Builtin.NativeObject), 1
@@ -342,14 +337,12 @@ class G {
// CHECK: [[T2:%.*]] = mark_dependence [[T1]] : $*Int32 on [[OWNER]] : $Builtin.NativeObject
// CHECK: store [[VALUE]] to [[T2]] : $*Int32
// CHECK: strong_release [[OWNER]] : $Builtin.NativeObject
// CHECK: strong_release [[SELF]] : $G
// materializeForSet for G.value
// CHECK: sil hidden [transparent] @_TFC10addressors1Gm5valueVSs5Int32 : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @owned G) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout G, @thick G.Type) -> ()>) {
// CHECK: sil hidden [transparent] @_TFC10addressors1Gm5valueVSs5Int32 : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed G) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout G, @thick G.Type) -> ()>) {
// CHECK: bb0([[BUFFER:%0]] : $Builtin.RawPointer, [[STORAGE:%1]] : $*Builtin.UnsafeValueBuffer, [[SELF:%2]] : $G):
// Call the addressor.
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Gao5valueVSs5Int32 : $@cc(method) @thin (@owned G) -> @owned (UnsafeMutablePointer<Int32>, Builtin.NativeObject)
// CHECK: strong_retain [[SELF]] : $G
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Gao5valueVSs5Int32 : $@cc(method) @thin (@guaranteed G) -> @owned (UnsafeMutablePointer<Int32>, Builtin.NativeObject)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[T1:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Builtin.NativeObject), 0
// CHECK: [[T2:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Builtin.NativeObject), 1
@@ -363,6 +356,7 @@ class G {
// CHECK: store [[T3]] to [[T2]] : $*Builtin.NativeObject
// Pull out the address.
// CHECK: [[T0:%.*]] = tuple_extract [[TUPLE]] : $(UnsafeMutablePointer<Int32>, Builtin.NativeObject), 0
// CHECK: [[ADDR_OWNER:%.*]] = tuple_extract [[TUPLE]] : $(UnsafeMutablePointer<Int32>, Builtin.NativeObject), 1
// CHECK: [[PTR:%.*]] = struct_extract [[T0]] :
// Set up the callback.
// CHECK: [[TEMP:%.*]] = alloc_stack $Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout G, @thick G.Type) -> ()>
@@ -373,8 +367,8 @@ class G {
// CHECK: [[CALLBACK:%.*]] = load [[TEMP]]#1 :
// Epilogue.
// CHECK: [[RESULT:%.*]] = tuple ([[PTR]] : $Builtin.RawPointer, [[CALLBACK]] : $Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout G, @thick G.Type) -> ()>)
// CHECK: strong_release [[ADDR_OWNER]]
// CHECK: release_value [[TUPLE]]
// CHECK: strong_release [[SELF]]
// CHECK: return [[RESULT]]
// materializeForSet callback for G.value
@@ -400,16 +394,15 @@ class H {
}
}
// CHECK: sil hidden @_TFC10addressors1Hlp5valueVSs5Int32 : $@cc(method) @thin (@owned H) -> @owned (UnsafePointer<Int32>, Optional<Builtin.NativeObject>) {
// CHECK: sil hidden @_TFC10addressors1Hap5valueVSs5Int32 : $@cc(method) @thin (@owned H) -> @owned (UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>) {
// CHECK: sil hidden @_TFC10addressors1Hlp5valueVSs5Int32 : $@cc(method) @thin (@guaranteed H) -> @owned (UnsafePointer<Int32>, Optional<Builtin.NativeObject>) {
// CHECK: sil hidden @_TFC10addressors1Hap5valueVSs5Int32 : $@cc(method) @thin (@guaranteed H) -> @owned (UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>) {
func test_h0(f: H) -> Int32 {
return f.value
}
// CHECK-LABEL: sil hidden @_TF10addressors7test_h0FCS_1HVSs5Int32 : $@thin (@owned H) -> Int32 {
// CHECK: bb0([[SELF:%0]] : $H):
// CHECK: strong_retain [[SELF]] : $H
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Hlp5valueVSs5Int32 : $@cc(method) @thin (@owned H) -> @owned (UnsafePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Hlp5valueVSs5Int32 : $@cc(method) @thin (@guaranteed H) -> @owned (UnsafePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[PTR:%.*]] = tuple_extract [[T0]] : $(UnsafePointer<Int32>, Optional<Builtin.NativeObject>), 0
// CHECK: [[OWNER:%.*]] = tuple_extract [[T0]] : $(UnsafePointer<Int32>, Optional<Builtin.NativeObject>), 1
@@ -428,8 +421,7 @@ func test_h1(f: H) {
// CHECK: bb0([[SELF:%0]] : $H):
// CHECK: [[T0:%.*]] = integer_literal $Builtin.Int32, 14
// CHECK: [[VALUE:%.*]] = struct $Int32 ([[T0]] : $Builtin.Int32)
// CHECK: strong_retain [[SELF]] : $H
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Hap5valueVSs5Int32 : $@cc(method) @thin (@owned H) -> @owned (UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Hap5valueVSs5Int32 : $@cc(method) @thin (@guaranteed H) -> @owned (UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[PTR:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>), 0
// CHECK: [[OWNER:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>), 1
@@ -452,10 +444,9 @@ class I {
}
}
}
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Ig5valueVSs5Int32 : $@cc(method) @thin (@owned I) -> Int32 {
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Ig5valueVSs5Int32 : $@cc(method) @thin (@guaranteed I) -> Int32 {
// CHECK: bb0([[SELF:%0]] : $I):
// CHECK: strong_retain [[SELF]]
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Ilp5valueVSs5Int32 : $@cc(method) @thin (@owned I) -> @owned (UnsafePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Ilp5valueVSs5Int32 : $@cc(method) @thin (@guaranteed I) -> @owned (UnsafePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[PTR:%.*]] = tuple_extract [[T0]] : $(UnsafePointer<Int32>, Optional<Builtin.NativeObject>), 0
// CHECK: [[OWNER:%.*]] = tuple_extract [[T0]] : $(UnsafePointer<Int32>, Optional<Builtin.NativeObject>), 1
@@ -464,13 +455,11 @@ class I {
// CHECK: [[T2:%.*]] = mark_dependence [[T1]] : $*Int32 on [[OWNER]] : $Optional<Builtin.NativeObject>
// CHECK: [[VALUE:%.*]] = load [[T2]] : $*Int32
// CHECK: strong_unpin [[OWNER]] : $Optional<Builtin.NativeObject>
// CHECK: strong_release [[SELF]] : $I
// CHECK: return [[VALUE]] : $Int32
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Is5valueVSs5Int32 : $@cc(method) @thin (Int32, @owned I) -> () {
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Is5valueVSs5Int32 : $@cc(method) @thin (Int32, @guaranteed I) -> () {
// CHECK: bb0([[VALUE:%0]] : $Int32, [[SELF:%1]] : $I):
// CHECK: strong_retain [[SELF]] : $I
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Iap5valueVSs5Int32 : $@cc(method) @thin (@owned I) -> @owned (UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Iap5valueVSs5Int32 : $@cc(method) @thin (@guaranteed I) -> @owned (UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[PTR:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>), 0
// CHECK: [[OWNER:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>), 1
@@ -479,13 +468,11 @@ class I {
// CHECK: [[T2:%.*]] = mark_dependence [[T1]] : $*Int32 on [[OWNER]] : $Optional<Builtin.NativeObject>
// CHECK: store [[VALUE]] to [[T2]] : $*Int32
// CHECK: strong_unpin [[OWNER]] : $Optional<Builtin.NativeObject>
// CHECK: strong_release [[SELF]] : $I
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Im5valueVSs5Int32 : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @owned I) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout I, @thick I.Type) -> ()>) {
// CHECK-LABEL: sil hidden [transparent] @_TFC10addressors1Im5valueVSs5Int32 : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed I) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout I, @thick I.Type) -> ()>) {
// CHECK: bb0([[BUFFER:%0]] : $Builtin.RawPointer, [[STORAGE:%1]] : $*Builtin.UnsafeValueBuffer, [[SELF:%2]] : $I):
// Call the addressor.
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Iap5valueVSs5Int32 : $@cc(method) @thin (@owned I) -> @owned (UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: strong_retain [[SELF]] : $I
// CHECK: [[ADDRESSOR:%.*]] = function_ref @_TFC10addressors1Iap5valueVSs5Int32 : $@cc(method) @thin (@guaranteed I) -> @owned (UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>)
// CHECK: [[T0:%.*]] = apply [[ADDRESSOR]]([[SELF]])
// CHECK: [[T1:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>), 0
// CHECK: [[T2:%.*]] = tuple_extract [[T0]] : $(UnsafeMutablePointer<Int32>, Optional<Builtin.NativeObject>), 1
@@ -510,7 +497,6 @@ class I {
// Epilogue.
// CHECK: [[RESULT:%.*]] = tuple ([[PTR]] : $Builtin.RawPointer, [[CALLBACK]] : $Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout I, @thick I.Type) -> ()>)
// CHECK: release_value [[TUPLE]]
// CHECK: strong_release [[SELF]]
// CHECK: return [[RESULT]]
// materializeForSet callback for I.value

View File

@@ -35,7 +35,7 @@ public class Base {
}
public class Sub : Base {
// CHECK-LABEL: sil hidden @_TFC13auto_closures3Subg1xVS_4Bool : $@cc(method) @thin (@owned Sub) -> Bool {
// CHECK-LABEL: sil hidden @_TFC13auto_closures3Subg1xVS_4Bool : $@cc(method) @thin (@guaranteed Sub) -> Bool {
// CHECK: [[AUTOCLOSURE:%.*]] = function_ref @_TFFC13auto_closures3Subg1xVS_4Boolu_KT_S1_ : $@thin (@owned Sub) -> Bool
// CHECK: = partial_apply [[AUTOCLOSURE]](%0)
// CHECK: return {{%.*}} : $Bool

View File

@@ -68,11 +68,10 @@ extension _ErrorType {
func test_extension_method(error: _ErrorType) {
// CHECK: [[VALUE:%.*]] = open_existential_box %0
// CHECK: [[METHOD:%.*]] = function_ref
// CHECK: copy_addr [[VALUE]] to [initialization] [[COPY:%.*]]#1 :
// CHECK: apply [[METHOD]]<{{.*}}>([[COPY]]#1)
// CHECK-NOT: copy_addr
// CHECK: apply [[METHOD]]<{{.*}}>([[VALUE]])
// CHECK-NOT: destroy_addr [[COPY]]
// CHECK-NOT: destroy_addr [[VALUE]]
// CHECK: dealloc_stack [[COPY]]#0
// CHECK-NOT: destroy_addr [[VALUE]]
// -- release the owned argument
// CHECK: strong_release %0
@@ -91,9 +90,8 @@ func test_open_existential_semantics(guaranteed: _ErrorType,
// CHECK-NOT: strong_retain %0
// CHECK: [[VALUE:%.*]] = open_existential_box %0
// CHECK: [[METHOD:%.*]] = function_ref
// CHECK: copy_addr [[VALUE]] to [initialization] [[COPY:%.*]]#1 :
// CHECK: apply [[METHOD]]<{{.*}}>([[COPY]]#1)
// CHECK: dealloc_stack [[COPY]]#0
// CHECK-NOT: copy_addr
// CHECK: apply [[METHOD]]<{{.*}}>([[VALUE]])
// CHECK-NOT: strong_release %0
// GUARANTEED-NOT: strong_retain %0
@@ -109,9 +107,8 @@ func test_open_existential_semantics(guaranteed: _ErrorType,
// CHECK: strong_retain [[IMMEDIATE]]
// CHECK: [[VALUE:%.*]] = open_existential_box [[IMMEDIATE]]
// CHECK: [[METHOD:%.*]] = function_ref
// CHECK: copy_addr [[VALUE]] to [initialization] [[COPY:%.*]]#1 :
// CHECK: apply [[METHOD]]<{{.*}}>([[COPY]]#1)
// CHECK: dealloc_stack [[COPY]]#0
// CHECK-NOT: copy_addr
// CHECK: apply [[METHOD]]<{{.*}}>([[VALUE]])
// -- end the guarantee
// -- TODO: could in theory do this sooner, after the value's been copied
// out.
@@ -132,9 +129,8 @@ func test_open_existential_semantics(guaranteed: _ErrorType,
// CHECK: [[PLUS_ONE:%.*]] = apply [[F]]()
// CHECK: [[VALUE:%.*]] = open_existential_box [[PLUS_ONE]]
// CHECK: [[METHOD:%.*]] = function_ref
// CHECK: copy_addr [[VALUE]] to [initialization] [[COPY:%.*]]#1 :
// CHECK: apply [[METHOD]]<{{.*}}>([[COPY]]#1)
// CHECK: dealloc_stack [[COPY]]#0
// CHECK-NOT: copy_addr
// CHECK: apply [[METHOD]]<{{.*}}>([[VALUE]])
// CHECK: strong_release [[PLUS_ONE]]
// GUARANTEED: [[F:%.*]] = function_ref {{.*}}plusOneErrorType

View File

@@ -495,7 +495,7 @@ class SuperSub : SuperBase {
}
}
// CHECK-LABEL: sil hidden @_TFC8closures24UnownedSelfNestedCapture13nestedCapturefS0_FT_T_ : $@cc(method) @thin (@owned UnownedSelfNestedCapture) -> ()
// CHECK-LABEL: sil hidden @_TFC8closures24UnownedSelfNestedCapture13nestedCapturefS0_FT_T_ : $@cc(method) @thin (@guaranteed UnownedSelfNestedCapture) -> ()
// CHECK: [[OUTER_SELF_CAPTURE:%.*]] = alloc_box $@sil_unowned UnownedSelfNestedCapture
// CHECK: [[UNOWNED_SELF:%.*]] = ref_to_unowned [[SELF_PARAM:%.*]] :
// -- TODO: A lot of fussy r/r traffic and owned/unowned conversions here.
@@ -516,12 +516,12 @@ class SuperSub : SuperBase {
// -- call consumes closure
// -- strong +1, unowned +1
// CHECK: [[INNER_CLOSURE:%.*]] = apply [[OUTER_CLOSURE]]
// CHECK: apply [[INNER_CLOSURE]]()
// CHECK: [[CONSUMED_RESULT:%.*]] = apply [[INNER_CLOSURE]]()
// CHECK: strong_release [[CONSUMED_RESULT]]
// -- releases unowned self in box
// -- strong +1, unowned +0
// CHECK: strong_release [[OUTER_SELF_CAPTURE]]
// -- strong +0, unowned +0
// CHECK: strong_release [[SELF_PARAM]]
// CHECK: return
// -- outer closure

View File

@@ -420,7 +420,7 @@ public class Base {
}
public class Sub : Base {
// CHECK-LABEL: sil hidden @_TFC7dynamic3Subg1xSb : $@cc(method) @thin (@owned Sub) -> Bool {
// CHECK-LABEL: sil hidden @_TFC7dynamic3Subg1xSb : $@cc(method) @thin (@guaranteed Sub) -> Bool {
// CHECK: [[AUTOCLOSURE:%.*]] = function_ref @_TFFC7dynamic3Subg1xSbu_KT_Sb : $@thin (@owned Sub) -> Bool
// CHECK: = partial_apply [[AUTOCLOSURE]](%0)
// CHECK: return {{%.*}} : $Bool

View File

@@ -11,7 +11,7 @@ protocol CP : class {
class X : P, CP {
required init(int i: Int) { }
// CHECK-LABEL: sil hidden @_TFC12dynamic_self1X1ffDS0_FT_DS0_ : $@cc(method) @thin (@owned X) -> @owned
// CHECK-LABEL: sil hidden @_TFC12dynamic_self1X1ffDS0_FT_DS0_ : $@cc(method) @thin (@guaranteed X) -> @owned
func f() -> Self { return self }
// CHECK-LABEL: sil hidden @_TZFC12dynamic_self1X7factory{{.*}} : $@thin (Int, @thick X.Type) -> @owned X
@@ -34,22 +34,28 @@ class GY<T> : GX<[T]> { }
// CHECK-LABEL: sil hidden @_TF12dynamic_self23testDynamicSelfDispatch{{.*}} : $@thin (@owned Y) -> ()
func testDynamicSelfDispatch(y: Y) {
// CHECK: bb0([[Y:%[0-9]+]] : $Y):
// CHECK: strong_retain [[Y]]
// CHECK: [[Y_AS_X:%[0-9]+]] = upcast [[Y]] : $Y to $X
// CHECK: [[X_F:%[0-9]+]] = class_method [[Y_AS_X]] : $X, #X.f!1 : Self -> () -> Self , $@cc(method) @thin (@owned X) -> @owned X
// CHECK: [[X_RESULT:%[0-9]+]] = apply [[X_F]]([[Y_AS_X]]) : $@cc(method) @thin (@owned X) -> @owned X
// CHECK: [[X_F:%[0-9]+]] = class_method [[Y_AS_X]] : $X, #X.f!1 : Self -> () -> Self , $@cc(method) @thin (@guaranteed X) -> @owned X
// CHECK: [[X_RESULT:%[0-9]+]] = apply [[X_F]]([[Y_AS_X]]) : $@cc(method) @thin (@guaranteed X) -> @owned X
// CHECK: strong_release [[Y_AS_X]]
// CHECK: [[Y_RESULT:%[0-9]+]] = unchecked_ref_cast [[X_RESULT]] : $X to $Y
// CHECK: strong_release [[Y_RESULT]] : $Y
// CHECK: strong_release [[Y]] : $Y
y.f()
}
// CHECK-LABEL: sil hidden @_TF12dynamic_self30testDynamicSelfDispatchGeneric{{.*}} : $@thin (@owned GY<Int>) -> ()
func testDynamicSelfDispatchGeneric(gy: GY<Int>) {
// CHECK: bb0([[GY:%[0-9]+]] : $GY<Int>):
// CHECK: strong_retain [[GY]]
// CHECK: [[GY_AS_GX:%[0-9]+]] = upcast [[GY]] : $GY<Int> to $GX<Array<Int>>
// CHECK: [[GX_F:%[0-9]+]] = class_method [[GY_AS_GX]] : $GX<Array<Int>>, #GX.f!1 : <T> Self -> () -> Self , $@cc(method) @thin <τ_0_0> (@owned GX<τ_0_0>) -> @owned GX<τ_0_0>
// CHECK: [[GX_RESULT:%[0-9]+]] = apply [[GX_F]]<[Int]>([[GY_AS_GX]]) : $@cc(method) @thin <τ_0_0> (@owned GX<τ_0_0>) -> @owned GX<τ_0_0>
// CHECK: [[GX_F:%[0-9]+]] = class_method [[GY_AS_GX]] : $GX<Array<Int>>, #GX.f!1 : <T> Self -> () -> Self , $@cc(method) @thin <τ_0_0> (@guaranteed GX<τ_0_0>) -> @owned GX<τ_0_0>
// CHECK: [[GX_RESULT:%[0-9]+]] = apply [[GX_F]]<[Int]>([[GY_AS_GX]]) : $@cc(method) @thin <τ_0_0> (@guaranteed GX<τ_0_0>) -> @owned GX<τ_0_0>
// CHECK: strong_release [[GY_AS_GX]]
// CHECK: [[GY_RESULT:%[0-9]+]] = unchecked_ref_cast [[GX_RESULT]] : $GX<Array<Int>> to $GY<Int>
// CHECK: strong_release [[GY_RESULT]] : $GY<Int>
// CHECK: strong_release [[GY]]
gy.f()
}
@@ -80,8 +86,8 @@ func testExistentialDispatch(p: P) {
func testExistentialDispatchClass(cp: CP) {
// CHECK: bb0([[CP:%[0-9]+]] : $CP):
// CHECK: [[CP_ADDR:%[0-9]+]] = open_existential_ref [[CP]] : $CP to $@opened([[N:".*"]]) CP
// CHECK: [[CP_F:%[0-9]+]] = witness_method $@opened([[N]]) CP, #CP.f!1, [[CP_ADDR]]{{.*}} : $@cc(witness_method) @thin <τ_0_0 where τ_0_0 : CP> (@owned τ_0_0) -> @owned τ_0_0
// CHECK: [[CP_F_RESULT:%[0-9]+]] = apply [[CP_F]]<@opened([[N]]) CP>([[CP_ADDR]]) : $@cc(witness_method) @thin <τ_0_0 where τ_0_0 : CP> (@owned τ_0_0) -> @owned τ_0_0
// CHECK: [[CP_F:%[0-9]+]] = witness_method $@opened([[N]]) CP, #CP.f!1, [[CP_ADDR]]{{.*}} : $@cc(witness_method) @thin <τ_0_0 where τ_0_0 : CP> (@guaranteed τ_0_0) -> @owned τ_0_0
// CHECK: [[CP_F_RESULT:%[0-9]+]] = apply [[CP_F]]<@opened([[N]]) CP>([[CP_ADDR]]) : $@cc(witness_method) @thin <τ_0_0 where τ_0_0 : CP> (@guaranteed τ_0_0) -> @owned τ_0_0
// CHECK: [[RESULT_EXISTENTIAL:%[0-9]+]] = init_existential_ref [[CP_F_RESULT]] : $@opened([[N]]) CP : $@opened([[N]]) CP, $CP
// CHECK: strong_release [[CP_F_RESULT]] : $@opened([[N]]) CP
cp.f()
@@ -123,14 +129,13 @@ func testObjCInit(meta: ObjCInit.Type) {
class OptionalResult {
func foo() -> Self? { return self }
}
// CHECK-LABEL: sil hidden @_TFC12dynamic_self14OptionalResult3foofDS0_FT_GSqDS0__ : $@cc(method) @thin (@owned OptionalResult) -> @owned Optional<OptionalResult>
// CHECK-LABEL: sil hidden @_TFC12dynamic_self14OptionalResult3foofDS0_FT_GSqDS0__ : $@cc(method) @thin (@guaranteed OptionalResult) -> @owned Optional<OptionalResult>
// CHECK: [[SOME:%.*]] = init_enum_data_addr [[OPT:%[0-9]+]]
// CHECK-NEXT: strong_retain [[VALUE:%[0-9]+]]
// CHECK-NEXT: store [[VALUE]] to [[SOME]]
// CHECK-NEXT: inject_enum_addr [[OPT]]{{.*}}Some
// CHECK-NEXT: [[T0:%.*]] = load [[OPT]]#1
// CHECK-NEXT: dealloc_stack [[OPT]]#0
// CHECK-NEXT: strong_release [[VALUE]]
// CHECK-NEXT: return [[T0]] : $Optional<OptionalResult>
class OptionalResultInheritor : OptionalResult {
@@ -141,7 +146,7 @@ func testOptionalResult(v : OptionalResultInheritor) {
v.foo()?.bar()
}
// CHECK-LABEL: sil hidden @_TF12dynamic_self18testOptionalResult{{.*}} : $@thin (@owned OptionalResultInheritor) -> ()
// CHECK: [[T0:%.*]] = class_method [[V:%.*]] : $OptionalResult, #OptionalResult.foo!1 : Self -> () -> Self? , $@cc(method) @thin (@owned OptionalResult) -> @owned Optional<OptionalResult>
// CHECK: [[T0:%.*]] = class_method [[V:%.*]] : $OptionalResult, #OptionalResult.foo!1 : Self -> () -> Self? , $@cc(method) @thin (@guaranteed OptionalResult) -> @owned Optional<OptionalResult>
// CHECK-NEXT: apply [[T0]]([[V]])
// CHECK: select_enum_addr
// CHECK: [[T1:%.*]] = unchecked_take_enum_data_addr

View File

@@ -12,7 +12,7 @@ class C {}
class D: C {}
// CHECK-LABEL: sil hidden @_TF27force_cast_chained_optional4testFCS_3FooCS_1D
// CHECK: class_method %0 : $Foo, #Foo.bar!getter.1 : Foo -> () -> Bar! , $@cc(method) @thin (@owned Foo) ->
// CHECK: class_method %0 : $Foo, #Foo.bar!getter.1 : Foo -> () -> Bar! , $@cc(method) @thin (@guaranteed Foo) ->
// CHECK: select_enum_addr
// CHECK: cond_br {{%.*}}, [[SOME_BAR:bb[0-9]+]], [[NO_BAR:bb[0-9]+]]
// CHECK: [[NO_BAR]]:
@@ -20,7 +20,7 @@ class D: C {}
// CHECK: [[SOME_BAR]]:
// CHECK: [[PAYLOAD_ADDR:%.*]] = unchecked_take_enum_data_addr {{%.*}} : $*ImplicitlyUnwrappedOptional<Bar>
// CHECK: [[BAR:%.*]] = load [[PAYLOAD_ADDR]]
// CHECK: class_method {{%.*}} : $Bar, #Bar.bas!getter.1 : Bar -> () -> C! , $@cc(method) @thin (@owned Bar) ->
// CHECK: class_method {{%.*}} : $Bar, #Bar.bas!getter.1 : Bar -> () -> C! , $@cc(method) @thin (@guaranteed Bar) ->
// CHECK: function_ref @_TFSs36_getImplicitlyUnwrappedOptionalValueU__FGSQQ__Q_
// CHECK: unconditional_checked_cast {{%.*}} : $C to $D
// CHECK: [[TRAP]]:

View File

@@ -80,11 +80,11 @@ class SomeClass {
// CHECK: bb0(%0 : $Builtin.Int64, %1 : $Builtin.Int64, %2 : $@thick SomeClass.Type):
init(x:Int, y:Int) {}
// CHECK-LABEL: sil hidden @_TFC9functions9SomeClass6method{{.*}} : $@cc(method) @thin (Builtin.Int64, @owned SomeClass) -> ()
// CHECK-LABEL: sil hidden @_TFC9functions9SomeClass6method{{.*}} : $@cc(method) @thin (Builtin.Int64, @guaranteed SomeClass) -> ()
// CHECK: bb0(%0 : $Builtin.Int64, %1 : $SomeClass):
func method(x: Int) {}
// CHECK-LABEL: sil hidden @_TFC9functions9SomeClass14curried_method{{.*}} : $@cc(method) @thin (Builtin.Int64, Builtin.Int64, @owned SomeClass) -> ()
// CHECK-LABEL: sil hidden @_TFC9functions9SomeClass14curried_method{{.*}} : $@cc(method) @thin (Builtin.Int64, Builtin.Int64, @guaranteed SomeClass) -> ()
// CHECK: bb0(%0 : $Builtin.Int64, %1 : $Builtin.Int64, %2 : $SomeClass):
func curried_method(x: Int)(y: Int) {}
@@ -325,7 +325,7 @@ func calls(var i:Int, var j:Int, var k:Int) {
// CHECK: [[C:%[0-9]+]] = load [[CADDR]]
// CHECK: [[J:%[0-9]+]] = load [[JADDR]]
// CHECK: [[K:%[0-9]+]] = load [[KADDR]]
// CHECK: [[GETTER:%[0-9]+]] = class_method [[C]] : $SomeClass, #SomeClass.subscript!getter.1 : SomeClass -> (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 , $@cc(method) @thin (Builtin.Int64, Builtin.Int64, @owned SomeClass) -> Builtin.Int64
// CHECK: [[GETTER:%[0-9]+]] = class_method [[C]] : $SomeClass, #SomeClass.subscript!getter.1 : SomeClass -> (Builtin.Int64, Builtin.Int64) -> Builtin.Int64 , $@cc(method) @thin (Builtin.Int64, Builtin.Int64, @guaranteed SomeClass) -> Builtin.Int64
// CHECK: apply [[GETTER]]([[J]], [[K]], [[C]])
i = c[j, k]
@@ -333,7 +333,7 @@ func calls(var i:Int, var j:Int, var k:Int) {
// CHECK: [[I:%[0-9]+]] = load [[IADDR]]
// CHECK: [[J:%[0-9]+]] = load [[JADDR]]
// CHECK: [[K:%[0-9]+]] = load [[KADDR]]
// CHECK: [[SETTER:%[0-9]+]] = class_method [[C]] : $SomeClass, #SomeClass.subscript!setter.1 : SomeClass -> (Builtin.Int64, Builtin.Int64, Builtin.Int64) -> () , $@cc(method) @thin (Builtin.Int64, Builtin.Int64, Builtin.Int64, @owned SomeClass) -> ()
// CHECK: [[SETTER:%[0-9]+]] = class_method [[C]] : $SomeClass, #SomeClass.subscript!setter.1 : SomeClass -> (Builtin.Int64, Builtin.Int64, Builtin.Int64) -> () , $@cc(method) @thin (Builtin.Int64, Builtin.Int64, Builtin.Int64, @guaranteed SomeClass) -> ()
// CHECK: apply [[SETTER]]([[K]], [[I]], [[J]], [[C]])
c[i, j] = k
@@ -567,8 +567,8 @@ final class r17828355Class {
// CHECK-LABEL: sil shared @_TFC9functions14r17828355Class6methodFS0_FBi64_T_
// CHECK-NEXT: bb0(%0 : $r17828355Class):
// CHECK-NEXT: // function_ref functions.r17828355Class.method (functions.r17828355Class)(Builtin.Int64) -> ()
// CHECK-NEXT: %1 = function_ref @_TFC9functions14r17828355Class6methodfS0_FBi64_T_ : $@cc(method) @thin (Builtin.Int64, @owned r17828355Class) -> ()
// CHECK-NEXT: partial_apply %1(%0) : $@cc(method) @thin (Builtin.Int64, @owned r17828355Class) -> ()
// CHECK-NEXT: %1 = function_ref @_TFC9functions14r17828355Class6methodfS0_FBi64_T_ : $@cc(method) @thin (Builtin.Int64, @guaranteed r17828355Class) -> ()
// CHECK-NEXT: partial_apply %1(%0) : $@cc(method) @thin (Builtin.Int64, @guaranteed r17828355Class) -> ()
// CHECK-NEXT: return

View File

@@ -18,6 +18,7 @@ protocol ProtocolB {
// CHECK: strong_retain [[PROJECTION]]
// CHECK: apply {{%.*}}<@opened{{.*}}>([[PROJECTION]])
// CHECK: strong_release %0
// CHECK-NOT: strong_release
func getIntPropExistential(a: ProtocolA) -> Int {
return a.intProp
}
@@ -27,12 +28,13 @@ func getIntPropExistential(a: ProtocolA) -> Int {
// CHECK: strong_retain [[PROJECTION]]
// CHECK: apply {{%.*}}<@opened{{.*}}>({{%.*}}, [[PROJECTION]])
// CHECK: strong_release %0
// CHECK_NOT: strong_release
func setIntPropExistential(a: ProtocolA) {
a.intProp = 0
}
// CHECK-LABEL: sil hidden @_TF30generic_property_base_lifetime17getIntPropGenericUS_9ProtocolA__FQ_Si
// CHECK: strong_retain %0
// CHECK-NOT: strong_retain %0
// CHECK: apply {{%.*}}<T>(%0)
// CHECK: strong_release %0
func getIntPropGeneric<T: ProtocolA>(a: T) -> Int {
@@ -40,7 +42,7 @@ func getIntPropGeneric<T: ProtocolA>(a: T) -> Int {
}
// CHECK-LABEL: sil hidden @_TF30generic_property_base_lifetime17setIntPropGenericUS_9ProtocolA__FQ_T_
// CHECK: strong_retain %0
// CHECK-NOT: strong_retain %0
// CHECK: apply {{%.*}}<T>({{%.*}}, %0)
// CHECK: strong_release %0
func setIntPropGeneric<T: ProtocolA>(a: T) {
@@ -97,19 +99,19 @@ func setIntPropExistential(a: ProtocolO) {
}
// CHECK-LABEL: sil hidden @_TF30generic_property_base_lifetime17getIntPropGenericUS_9ProtocolO__FQ_Si
// CHECK: strong_retain %0
// CHECK-NOT: strong_retain %0
// CHECK: apply {{%.*}}<T>(%0)
// CHECK: strong_release %0
// CHECK: strong_release %0
// CHECK-NOT: strong_release %0
func getIntPropGeneric<T: ProtocolO>(a: T) -> Int {
return a.intProp
}
// CHECK-LABEL: sil hidden @_TF30generic_property_base_lifetime17setIntPropGenericUS_9ProtocolO__FQ_T_
// CHECK: strong_retain %0
// CHECK-NOT: strong_retain %0
// CHECK: apply {{%.*}}<T>({{%.*}}, %0)
// CHECK: strong_release %0
// CHECK: strong_release %0
// CHECK-NOT: strong_release %0
func setIntPropGeneric<T: ProtocolO>(a: T) {
a.intProp = 0
}

View File

@@ -395,30 +395,30 @@ struct StructMemberTest {
func testIntMemberLoad() -> Int {
return i
}
// CHECK-LABEL: sil hidden @{{.*}}testIntMemberLoad
// CHECK-LABEL: sil hidden @{{.*}}testIntMemberLoad{{.*}} : $@cc(method) @thin (@guaranteed StructMemberTest)
// CHECK: bb0(%0 : $StructMemberTest):
// CHECK: debug_value %0 : $StructMemberTest // let self
// CHECK: %2 = struct_extract %0 : $StructMemberTest, #StructMemberTest.i
// CHECK: release_value %0 : $StructMemberTest
// CHECK-NOT: release_value %0 : $StructMemberTest
// CHECK: return %2 : $Int
// Accessing the int member in s should not retain the whole struct.
func testRecursiveIntMemberLoad() -> Int {
return s.i
}
// CHECK-LABEL: sil hidden @{{.*}}testRecursiveIntMemberLoad
// CHECK-LABEL: sil hidden @{{.*}}testRecursiveIntMemberLoad{{.*}} : $@cc(method) @thin (@guaranteed StructMemberTest)
// CHECK: bb0(%0 : $StructMemberTest):
// CHECK: debug_value %0 : $StructMemberTest // let self
// CHECK: %2 = struct_extract %0 : $StructMemberTest, #StructMemberTest.s
// CHECK: %3 = struct_extract %2 : $AnotherStruct, #AnotherStruct.i
// CHECK: release_value %0 : $StructMemberTest
// CHECK-NOT: release_value %0 : $StructMemberTest
// CHECK: return %3 : $Int
func testTupleMemberLoad() -> Int {
return t.1.i
}
// FIXME: these retains and releases are unnecessary
// CHECK-LABEL: sil hidden @{{.*}}testTupleMemberLoad
// CHECK-LABEL: sil hidden @{{.*}}testTupleMemberLoad{{.*}} : $@cc(method) @thin (@guaranteed StructMemberTest)
// CHECK: bb0(%0 : $StructMemberTest):
// CHECK: debug_value %0 : $StructMemberTest // let self
// CHECK: [[T0:%.*]] = struct_extract %0 : $StructMemberTest, #StructMemberTest.t
@@ -427,7 +427,7 @@ struct StructMemberTest {
// CHECK: [[T2:%.*]] = tuple_extract [[T0]] : $(Int, AnotherStruct), 1
// CHECK: [[T3:%.*]] = struct_extract [[T2]] : $AnotherStruct, #AnotherStruct.i
// CHECK: release_value [[T2]] : $AnotherStruct
// CHECK: release_value %0 : $StructMemberTest
// CHECK-NOT: release_value %0 : $StructMemberTest
// CHECK: return [[T3]] : $Int
}
@@ -439,25 +439,24 @@ struct GenericStruct<T> {
func getA() -> T {
return a
}
// CHECK-LABEL: sil hidden @{{.*}}GenericStruct4getA
// CHECK-LABEL: sil hidden @{{.*}}GenericStruct4getA{{.*}} : $@cc(method) @thin <T> (@out T, @in_guaranteed GenericStruct<T>)
// CHECK-NEXT: bb0(%0 : $*T, %1 : $*GenericStruct<T>):
// CHECK-NEXT: debug_value_addr %1 : $*GenericStruct<T> // let self
// CHECK-NEXT: %3 = struct_element_addr %1 : $*GenericStruct<T>, #GenericStruct.a
// CHECK-NEXT: copy_addr %3 to [initialization] %0 : $*T
// CHECK-NEXT: destroy_addr %1 : $*GenericStruct<T>
// CHECK-NEXT: %6 = tuple ()
// CHECK-NEXT: return %6 : $()
// CHECK-NEXT: %5 = tuple ()
// CHECK-NEXT: return %5 : $()
func getB() -> Int {
return b
}
// CHECK-LABEL: sil hidden @{{.*}}GenericStruct4getB
// CHECK-LABEL: sil hidden @{{.*}}GenericStruct4getB{{.*}} : $@cc(method) @thin <T> (@in_guaranteed GenericStruct<T>) -> Int
// CHECK-NEXT: bb0(%0 : $*GenericStruct<T>):
// CHECK-NEXT: debug_value_addr %0 : $*GenericStruct<T> // let self
// CHECK-NEXT: %2 = struct_element_addr %0 : $*GenericStruct<T>, #GenericStruct.b
// CHECK-NEXT: %3 = load %2 : $*Int
// CHECK-NEXT: destroy_addr %0 : $*GenericStruct<T>
// CHECK-NOT: destroy_addr %0 : $*GenericStruct<T>
// CHECK-NEXT: return %3 : $Int
}

View File

@@ -339,7 +339,7 @@ class RefWithProp {
var aleph_prop: Aleph { get {} set {} }
}
// CHECK-LABEL: sil hidden @_TF8lifetime23logical_lvalue_lifetime
// CHECK-LABEL: sil hidden @_TF8lifetime23logical_lvalue_lifetimeFTCS_11RefWithPropSiVS_3Val_T_ : $@thin (@owned RefWithProp, Int, Val) -> () {
func logical_lvalue_lifetime(var r: RefWithProp, var i: Int, var v: Val) {
// CHECK: [[RADDR:%[0-9]+]] = alloc_box $RefWithProp
// CHECK: [[IADDR:%[0-9]+]] = alloc_box $Int
@@ -348,16 +348,16 @@ func logical_lvalue_lifetime(var r: RefWithProp, var i: Int, var v: Val) {
// -- Reference types need to be retained as property method args.
r.int_prop = i
// CHECK: [[R1:%[0-9]+]] = load [[RADDR]]
// CHECK: retain [[R1]]
// CHECK: [[SETTER_METHOD:%[0-9]+]] = class_method {{.*}} : $RefWithProp, #RefWithProp.int_prop!setter.1 : RefWithProp -> (Int) -> ()
// CHECK: strong_retain [[R1]]
// CHECK: [[SETTER_METHOD:%[0-9]+]] = class_method {{.*}} : $RefWithProp, #RefWithProp.int_prop!setter.1 : RefWithProp -> (Int) -> () , $@cc(method) @thin (Int, @guaranteed RefWithProp) -> ()
// CHECK: apply [[SETTER_METHOD]]({{.*}}, [[R1]])
// CHECK: strong_release [[R1]]
r.aleph_prop.b = v
// CHECK: [[R2:%[0-9]+]] = load [[RADDR]]
// CHECK: retain [[R2]]
// CHECK: strong_retain [[R2]]
// CHECK: [[STORAGE:%.*]] = alloc_stack $Builtin.UnsafeValueBuffer
// CHECK: [[ALEPH_PROP_TEMP:%[0-9]+]] = alloc_stack $Aleph
// CHECK: retain [[R2]]
// CHECK: [[T0:%.*]] = address_to_pointer [[ALEPH_PROP_TEMP]]#1
// CHECK: [[MATERIALIZE_METHOD:%[0-9]+]] = class_method {{.*}} : $RefWithProp, #RefWithProp.aleph_prop!materializeForSet.1 :
// CHECK: [[MATERIALIZE:%.*]] = apply [[MATERIALIZE_METHOD]]([[T0]], [[STORAGE]]#1, [[R2]])
@@ -460,13 +460,13 @@ class Foo<T> {
// Deallocating destructor for Foo.
// CHECK-LABEL: sil hidden @_TFC8lifetime3FooD : $@cc(method) @thin <T> (@owned Foo<T>) -> ()
// CHECK-NEXT: bb0([[SELF:%[0-9]+]] : $Foo<T>):
// CHECK: [[DESTROYING_REF:%[0-9]+]] = function_ref @_TFC8lifetime3Food : $@cc(method) @thin <τ_0_0> (@owned Foo<τ_0_0>) -> @owned Builtin.NativeObject
// CHECK-NEXT: [[RESULT_SELF:%[0-9]+]] = apply [[DESTROYING_REF]]<T>([[SELF]]) : $@cc(method) @thin <τ_0_0> (@owned Foo<τ_0_0>) -> @owned Builtin.NativeObject
// CHECK: [[DESTROYING_REF:%[0-9]+]] = function_ref @_TFC8lifetime3Food : $@cc(method) @thin <τ_0_0> (@guaranteed Foo<τ_0_0>) -> @owned Builtin.NativeObject
// CHECK-NEXT: [[RESULT_SELF:%[0-9]+]] = apply [[DESTROYING_REF]]<T>([[SELF]]) : $@cc(method) @thin <τ_0_0> (@guaranteed Foo<τ_0_0>) -> @owned Builtin.NativeObject
// CHECK-NEXT: [[SELF:%[0-9]+]] = unchecked_ref_cast [[RESULT_SELF]] : $Builtin.NativeObject to $Foo<T>
// CHECK-NEXT: dealloc_ref [[SELF]] : $Foo<T>
// CHECK-NEXT: [[RESULT:%[0-9]+]] = tuple ()
// CHECK-NEXT: return [[RESULT]] : $()
// CHECK-LABEL: sil hidden @_TFC8lifetime3Food : $@cc(method) @thin <T> (@owned Foo<T>) -> @owned Builtin.NativeObject
// CHECK-LABEL: sil hidden @_TFC8lifetime3Food : $@cc(method) @thin <T> (@guaranteed Foo<T>) -> @owned Builtin.NativeObject
deinit {
// CHECK: bb0([[THIS:%[0-9]+]] : $Foo<T>):
@@ -636,7 +636,7 @@ func downcast(var b: B) {
// CHECK: [[D:%[0-9]+]] = unconditional_checked_cast [[B]] : {{.*}} to $D
// CHECK: apply {{.*}}([[D]])
// CHECK-NOT: release [[B]]
// CHECK-NOT: release [[D]]
// CHECK: release [[D]]
// CHECK: release [[BADDR]]
// CHECK: return
}

View File

@@ -22,7 +22,7 @@ class Base {
// The ordering here is unfortunate: we generate the property
// getters and setters after we've processed the decl.
// CHECK: sil hidden [transparent] @_TFC17materializeForSet4Basem8computedSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @owned Base) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout Base, @thick Base.Type) -> ()>) {
// CHECK: sil hidden [transparent] @_TFC17materializeForSet4Basem8computedSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Base) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout Base, @thick Base.Type) -> ()>) {
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $Base):
// CHECK: [[ADDR:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to $*Int
// CHECK: [[T0:%.*]] = function_ref @_TFC17materializeForSet4Baseg8computedSi
@@ -46,7 +46,7 @@ class Base {
// CHECK: [[SETTER:%.*]] = function_ref @_TFC17materializeForSet4Bases8computedSi
// CHECK: apply [[SETTER]]([[T2]], [[T0]])
// CHECK: sil hidden [transparent] @_TFC17materializeForSet4Basem6storedSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @owned Base) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout Base, @thick Base.Type) -> ()>) {
// CHECK: sil hidden [transparent] @_TFC17materializeForSet4Basem6storedSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Base) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout Base, @thick Base.Type) -> ()>) {
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $Base):
// CHECK: [[T0:%.*]] = ref_element_addr [[SELF]] : $Base, #Base.stored
// CHECK: [[T1:%.*]] = address_to_pointer [[T0]] : $*Int to $Builtin.RawPointer
@@ -71,7 +71,7 @@ class HasDidSet : Base {
// Checking this after silgen, but before mandatory inlining, lets us
// test the intent much better.
// SILGEN: sil hidden [transparent] @_TFC17materializeForSet9HasDidSetm6storedSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @owned HasDidSet) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout HasDidSet, @thick HasDidSet.Type) -> ()>) {
// SILGEN: sil hidden [transparent] @_TFC17materializeForSet9HasDidSetm6storedSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasDidSet) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout HasDidSet, @thick HasDidSet.Type) -> ()>) {
// SILGEN: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $HasDidSet):
// SILGEN: [[T2:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to $*Int
// SILGEN: [[T0:%.*]] = function_ref @_TFC17materializeForSet9HasDidSetg6storedSi
@@ -87,7 +87,7 @@ class HasDidSet : Base {
set(value) {}
}
// CHECK: sil hidden [transparent] @_TFC17materializeForSet9HasDidSetm8computedSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @owned HasDidSet) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout HasDidSet, @thick HasDidSet.Type) -> ()>) {
// CHECK: sil hidden [transparent] @_TFC17materializeForSet9HasDidSetm8computedSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasDidSet) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout HasDidSet, @thick HasDidSet.Type) -> ()>) {
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $HasDidSet):
// CHECK: [[T2:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to $*Int
// CHECK: [[T0:%.*]] = function_ref @_TFC17materializeForSet9HasDidSetg8computedSi
@@ -102,7 +102,7 @@ class HasDidSet : Base {
class HasWeak {
weak var weakvar: HasWeak? = nil
}
// CHECK: sil hidden [transparent] @_TFC17materializeForSet7HasWeakm7weakvarXwGSqS0__ : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @owned HasWeak) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout HasWeak, @thick HasWeak.Type) -> ()>) {
// CHECK: sil hidden [transparent] @_TFC17materializeForSet7HasWeakm7weakvarXwGSqS0__ : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasWeak) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout HasWeak, @thick HasWeak.Type) -> ()>) {
// CHECK: bb0([[BUFFER:%.*]] : $Builtin.RawPointer, [[STORAGE:%.*]] : $*Builtin.UnsafeValueBuffer, [[SELF:%.*]] : $HasWeak):
// CHECK: [[T2:%.*]] = pointer_to_address [[BUFFER]] : $Builtin.RawPointer to $*Optional<HasWeak>
// CHECK: [[T0:%.*]] = ref_element_addr [[SELF]] : $HasWeak, #HasWeak.weakvar

View File

@@ -15,7 +15,7 @@ func lazyPropertiesAreNotStored(var container: LazyContainer) {
// CHECK-LABEL: sil hidden @_TF10multi_file29lazyRefPropertiesAreNotStored
func lazyRefPropertiesAreNotStored(container: LazyContainerClass) {
// CHECK: {{%[0-9]+}} = class_method %0 : $LazyContainerClass, #LazyContainerClass.lazyVar!getter.1 : LazyContainerClass -> () -> Int , $@cc(method) @thin (@owned LazyContainerClass) -> Int
// CHECK: {{%[0-9]+}} = class_method %0 : $LazyContainerClass, #LazyContainerClass.lazyVar!getter.1 : LazyContainerClass -> () -> Int , $@cc(method) @thin (@guaranteed LazyContainerClass) -> Int
println(container.lazyVar)
}
@@ -43,5 +43,5 @@ class HasComputedProperty: ProtocolWithProperty {
set {}
}
}
// CHECK-LABEL: sil hidden [transparent] @_TFC10multi_file19HasComputedPropertym3fooSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @owned HasComputedProperty) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout HasComputedProperty, @thick HasComputedProperty.Type) -> ()>) {
// CHECK-LABEL: sil hidden [transparent] @_TFC10multi_file19HasComputedPropertym3fooSi : $@cc(method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed HasComputedProperty) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout HasComputedProperty, @thick HasComputedProperty.Type) -> ()>) {
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWC10multi_file19HasComputedPropertyS_20ProtocolWithPropertyS_FS1_m3fooSi : $@cc(witness_method) @thin (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout HasComputedProperty) -> (Builtin.RawPointer, Optional<@thin (Builtin.RawPointer, inout Builtin.UnsafeValueBuffer, inout HasComputedProperty, @thick HasComputedProperty.Type) -> ()>) {

View File

@@ -18,7 +18,7 @@ class SwiftGizmo : Gizmo {
// CHECK-NOT: sil hidden @_TToFC19objc_attr_NSManaged10SwiftGizmos1xCS_1X
// Make sure that we're calling through the @objc entry points.
// CHECK-LABEL: sil hidden @_TFC19objc_attr_NSManaged10SwiftGizmo7modifyX{{.*}} : $@cc(method) @thin (@owned SwiftGizmo) -> () {
// CHECK-LABEL: sil hidden @_TFC19objc_attr_NSManaged10SwiftGizmo7modifyX{{.*}} : $@cc(method) @thin (@guaranteed SwiftGizmo) -> () {
func modifyX() {
// CHECK: [[GETTER:%[0-9]+]] = class_method [volatile] [[SELF:%.*]] : $SwiftGizmo, #SwiftGizmo.x!getter.1.foreign : SwiftGizmo -> () -> X , $@cc(objc_method) @thin (SwiftGizmo) -> @autoreleased X
// CHECK-NEXT: apply [[GETTER]]([[SELF]]) : $@cc(objc_method) @thin (SwiftGizmo) -> @autoreleased X

View File

@@ -9,7 +9,7 @@ import Foundation
// CHECK: [[COPY:%.*]] = copy_block %0
// CHECK: [[THUNK:%.*]] = function_ref @_TTRXFdCb_dSi_dSi_XFo_dSi_dSi_
// CHECK: [[BRIDGED:%.*]] = partial_apply [[THUNK]]([[COPY]])
// CHECK: [[NATIVE:%.*]] = function_ref @_TFC20objc_blocks_bridging3Foo3foo{{.*}} : $@cc(method) @thin (@owned @callee_owned (Int) -> Int, Int, @owned Foo) -> Int
// CHECK: [[NATIVE:%.*]] = function_ref @_TFC20objc_blocks_bridging3Foo3foo{{.*}} : $@cc(method) @thin (@owned @callee_owned (Int) -> Int, Int, @guaranteed Foo) -> Int
// CHECK: apply [[NATIVE]]([[BRIDGED]], %1, %2)
dynamic func foo(f: Int -> Int, x: Int) -> Int {
return f(x)
@@ -19,7 +19,7 @@ import Foundation
// CHECK: [[COPY:%.*]] = copy_block %0
// CHECK: [[THUNK:%.*]] = function_ref @_TTRXFdCb_dCSo8NSString_aS__XFo_oSS_oSS_
// CHECK: [[BRIDGED:%.*]] = partial_apply [[THUNK]]([[COPY]])
// CHECK: [[NATIVE:%.*]] = function_ref @_TFC20objc_blocks_bridging3Foo3bar{{.*}} : $@cc(method) @thin (@owned @callee_owned (@owned String) -> @owned String, @owned String, @owned Foo) -> @owned String
// CHECK: [[NATIVE:%.*]] = function_ref @_TFC20objc_blocks_bridging3Foo3bar{{.*}} : $@cc(method) @thin (@owned @callee_owned (@owned String) -> @owned String, @owned String, @guaranteed Foo) -> @owned String
// CHECK: apply [[NATIVE]]([[BRIDGED]], {{%.*}}, %2)
dynamic func bar(f: String -> String, x: String) -> String {
return f(x)
@@ -29,7 +29,7 @@ import Foundation
// CHECK: [[COPY:%.*]] = copy_block %0
// CHECK: [[THUNK:%.*]] = function_ref @_TTRXFdCb_dGSqCSo8NSString__aGSqS___XFo_oGSqSS__oGSqSS__
// CHECK: [[BRIDGED:%.*]] = partial_apply [[THUNK]]([[COPY]])
// CHECK: [[NATIVE:%.*]] = function_ref @_TFC20objc_blocks_bridging3Foo3bas{{.*}} : $@cc(method) @thin (@owned @callee_owned (@owned Optional<String>) -> @owned Optional<String>, @owned Optional<String>, @owned Foo) -> @owned Optional<String>
// CHECK: [[NATIVE:%.*]] = function_ref @_TFC20objc_blocks_bridging3Foo3bas{{.*}} : $@cc(method) @thin (@owned @callee_owned (@owned Optional<String>) -> @owned Optional<String>, @owned Optional<String>, @guaranteed Foo) -> @owned Optional<String>
// CHECK: apply [[NATIVE]]([[BRIDGED]], {{%.*}}, %2)
dynamic func bas(f: String? -> String?, x: String?) -> String? {
return f(x)
@@ -55,7 +55,7 @@ import Foundation
// CHECK: [[BRIDGED:%.*]] = partial_apply [[BLOCK_THUNK]]([[BLOCK]])
// CHECK: [[REABSTRACT_THUNK:%.*]] = function_ref @_TTRXFo_oSS_oSS_XFo_iSS_iSS_
// CHECK: [[REABSTRACT:%.*]] = partial_apply [[REABSTRACT_THUNK]]([[BRIDGED]])
// CHECK: [[NATIVE:%.*]] = function_ref @_TFC20objc_blocks_bridging3Foo7optFunc{{.*}} : $@cc(method) @thin (@owned Optional<String -> String>, @owned String, @owned Foo) -> @owned Optional<String>
// CHECK: [[NATIVE:%.*]] = function_ref @_TFC20objc_blocks_bridging3Foo7optFunc{{.*}} : $@cc(method) @thin (@owned Optional<String -> String>, @owned String, @guaranteed Foo) -> @owned Optional<String>
// CHECK: apply [[NATIVE]]
dynamic func optFunc(f: (String -> String)?, x: String) -> String? {
return f?(x)

View File

@@ -241,7 +241,8 @@ class Bas : NSObject {
// CHECK: strong_retain [[THIS]] : $Bas
// CHECK: // function_ref objc_bridging.Bas.strRealProp.getter
// CHECK: [[PROPIMPL:%.*]] = function_ref @_TFC13objc_bridging3Basg11strRealPropSS
// CHECK: [[PROP_COPY:%.*]] = apply [[PROPIMPL]]([[THIS]]) : $@cc(method) @thin (@owned Bas) -> @owned String
// CHECK: [[PROP_COPY:%.*]] = apply [[PROPIMPL]]([[THIS]]) : $@cc(method) @thin (@guaranteed Bas) -> @owned String
// CHECK: strong_release [[THIS]]
// CHECK: [[STRING_TO_NSSTRING:%.*]] = function_ref @swift_StringToNSString
// CHECK: [[NSSTR:%.*]] = apply [[STRING_TO_NSSTRING]]([[PROP_COPY]])
// CHECK: autorelease_return [[NSSTR]]
@@ -352,18 +353,21 @@ class Bas : NSObject {
// CHECK: [[CONV_FN:%[0-9]+]] = function_ref @_TF10Foundation22_convertNSArrayToArray{{.*}} : $@thin <τ_0_0> (@owned Optional<NSArray>) -> @owned Array<τ_0_0>
// CHECK-NEXT: [[OPT_NSARRAY:%[0-9]+]] = enum $Optional<NSArray>, #Optional.Some!enumelt.1, [[NSARRAY]] : $NSArray
// CHECK-NEXT: [[ARRAY:%[0-9]+]] = apply [[CONV_FN]]<AnyObject>([[OPT_NSARRAY]]) : $@thin <τ_0_0> (@owned Optional<NSArray>) -> @owned Array<τ_0_0>
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC13objc_bridging3Bas{{.*}} : $@cc(method) @thin (@owned Array<AnyObject>, @owned Bas) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SWIFT_FN]]([[ARRAY]], [[SELF]]) : $@cc(method) @thin (@owned Array<AnyObject>, @owned Bas) -> ()
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC13objc_bridging3Bas{{.*}} : $@cc(method) @thin (@owned Array<AnyObject>, @guaranteed Bas) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SWIFT_FN]]([[ARRAY]], [[SELF]]) : $@cc(method) @thin (@owned Array<AnyObject>, @guaranteed Bas) -> ()
// CHECK: strong_release [[SELF]] : $Bas
// CHECK: return [[RESULT]] : $()
func arrayArg(array: [AnyObject]) { }
// CHECK-LABEL: sil hidden @_TToFC13objc_bridging3Bas11arrayResult{{.*}} : $@cc(objc_method) @thin (Bas) -> @autoreleased NSArray
// CHECK: bb0([[SELF:%[0-9]+]] : $Bas):
// CHECK: strong_retain [[SELF]] : $Bas
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC13objc_bridging3Bas11arrayResult{{.*}} : $@cc(method) @thin (@owned Bas) -> @owned Array<AnyObject>
// CHECK: [[ARRAY:%[0-9]+]] = apply [[SWIFT_FN]]([[SELF]]) : $@cc(method) @thin (@owned Bas) -> @owned Array<AnyObject>
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC13objc_bridging3Bas11arrayResult{{.*}} : $@cc(method) @thin (@guaranteed Bas) -> @owned Array<AnyObject>
// CHECK: [[ARRAY:%[0-9]+]] = apply [[SWIFT_FN]]([[SELF]]) : $@cc(method) @thin (@guaranteed Bas) -> @owned Array<AnyObject>
// CHECK: strong_release [[SELF]]
// CHECK: [[CONV_FN:%[0-9]+]] = function_ref @_TF10Foundation22_convertArrayToNSArray{{.*}} : $@thin <τ_0_0> (@owned Array<τ_0_0>) -> @owned NSArray
// CHECK: [[NSARRAY:%[0-9]+]] = apply [[CONV_FN]]<AnyObject>([[ARRAY]]) : $@thin <τ_0_0> (@owned Array<τ_0_0>) -> @owned NSArray
// CHECK: autorelease_return [[NSARRAY]]
func arrayResult() -> [AnyObject] { return [] }
// CHECK-LABEL: sil hidden [transparent] @_TToFC13objc_bridging3Basg9arrayPropGSaSS_ : $@cc(objc_method) @thin (Bas) -> @autoreleased NSArray

View File

@@ -9,8 +9,11 @@ func curry_pod(x: CurryTest) -> Int -> Int {
return x.pod
}
// CHECK-LABEL: sil hidden @_TF13objc_currying9curry_podFCSo9CurryTestFSiSi : $@thin (@owned CurryTest) -> @owned @callee_owned (Int) -> Int
// CHECK: [[THUNK:%.*]] = function_ref [[THUNK_FOO_1:@_TTOFCSo9CurryTest3podFS_FSiSi]]
// CHECK: bb0([[ARG1:%.*]] : $CurryTest):
// CHECK: strong_retain [[ARG1]]
// CHECK: [[THUNK:%.*]] = function_ref [[THUNK_FOO_1:@_TTOFCSo9CurryTest3podFS_FSiSi]] : $@thin (@owned CurryTest) -> @owned @callee_owned (Int) -> Int
// CHECK: [[FN:%.*]] = apply [[THUNK]](%0)
// CHECK: strong_release [[ARG1]]
// CHECK: return [[FN]]
// CHECK: sil shared [[THUNK_FOO_1]] : $@thin (@owned CurryTest) -> @owned @callee_owned (Int) -> Int
@@ -18,10 +21,12 @@ func curry_pod(x: CurryTest) -> Int -> Int {
// CHECK: [[FN:%.*]] = partial_apply [[THUNK]](%0)
// CHECK: return [[FN]]
// CHECK: sil shared [[THUNK_FOO_2]] : $@cc(method) @thin (Int, @owned CurryTest) -> Int
// CHECK: sil shared [[THUNK_FOO_2]] : $@cc(method) @thin (Int, @guaranteed CurryTest) -> Int
// CHECK: bb0([[ARG1:%.*]] : $Int, [[ARG2:%.*]] : $CurryTest):
// CHECK: strong_retain [[ARG2]]
// CHECK: [[METHOD:%.*]] = class_method [volatile] %1 : $CurryTest, #CurryTest.pod!1.foreign
// CHECK: [[RESULT:%.*]] = apply [[METHOD]](%0, %1)
// CHECK: strong_release %1
// CHECK: strong_release [[ARG2]]
// CHECK: return [[RESULT]]
func curry_bridged(x: CurryTest) -> String! -> String! {
@@ -37,7 +42,7 @@ func curry_bridged(x: CurryTest) -> String! -> String! {
// CHECK: [[FN:%.*]] = partial_apply [[THUNK]](%0)
// CHECK: return [[FN]]
// CHECK: sil shared [[THUNK_BAR_2]] : $@cc(method) @thin (@owned ImplicitlyUnwrappedOptional<String>, @owned CurryTest) -> @owned ImplicitlyUnwrappedOptional<String>
// CHECK: sil shared [[THUNK_BAR_2]] : $@cc(method) @thin (@owned ImplicitlyUnwrappedOptional<String>, @guaranteed CurryTest) -> @owned ImplicitlyUnwrappedOptional<String>
// CHECK: function_ref @swift_StringToNSString
// CHECK: [[METHOD:%.*]] = class_method [volatile] %1 : $CurryTest, #CurryTest.bridged!1.foreign
// CHECK: [[RES:%.*]] = apply [[METHOD]]({{%.*}}, %1) : $@cc(objc_method) @thin (ImplicitlyUnwrappedOptional<NSString>, CurryTest) -> @autoreleased ImplicitlyUnwrappedOptional<NSString>
@@ -59,7 +64,9 @@ func curry_returnsInnerPointer(x: CurryTest) -> () -> UnsafeMutablePointer<Void>
// CHECK: [[FN:%.*]] = partial_apply [[THUNK]](%0)
// CHECK: return [[FN]]
// CHECK: sil shared @_TTOFCSo9CurryTest19returnsInnerPointerfS_FT_GVSs20UnsafeMutablePointerT__ : $@cc(method) @thin (@owned CurryTest) -> UnsafeMutablePointer<()>
// CHECK: sil shared @_TTOFCSo9CurryTest19returnsInnerPointerfS_FT_GVSs20UnsafeMutablePointerT__ : $@cc(method) @thin (@guaranteed CurryTest) -> UnsafeMutablePointer<()>
// CHECK: bb0([[ARG1:%.*]] :
// CHECK: strong_retain [[ARG1]]
// CHECK: [[METHOD:%.*]] = class_method [volatile] %0 : $CurryTest, #CurryTest.returnsInnerPointer!1.foreign
// CHECK: [[RES:%.*]] = apply [[METHOD]](%0) : $@cc(objc_method) @thin (CurryTest) -> @unowned_inner_pointer UnsafeMutablePointer<()>
// CHECK: autorelease_value %0

View File

@@ -14,8 +14,8 @@ import gizmo
// CHECK-NEXT: [[OPT_NSDICT:%[0-9]+]] = enum $Optional<NSDictionary>, #Optional.Some!enumelt.1, [[NSDICT]] : $NSDictionary
// CHECK-NEXT: [[DICT:%[0-9]+]] = apply [[CONVERTER]]<Foo, Foo>([[OPT_NSDICT]]) : $@thin <τ_0_0, τ_0_1 where τ_0_0 : NSObject, τ_0_0 : Hashable, τ_0_1 : AnyObject> (@owned Optional<NSDictionary>) -> @owned Dictionary<τ_0_0, τ_0_1>
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC24objc_dictionary_bridging3Foo23bridge_Dictionary_paramfS0_FGVSs10DictionaryS0_S0__T_ : $@cc(method) @thin (@owned Dictionary<Foo, Foo>, @owned Foo) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SWIFT_FN]]([[DICT]], [[SELF]]) : $@cc(method) @thin (@owned Dictionary<Foo, Foo>, @owned Foo) -> ()
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC24objc_dictionary_bridging3Foo23bridge_Dictionary_paramfS0_FGVSs10DictionaryS0_S0__T_ : $@cc(method) @thin (@owned Dictionary<Foo, Foo>, @guaranteed Foo) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SWIFT_FN]]([[DICT]], [[SELF]]) : $@cc(method) @thin (@owned Dictionary<Foo, Foo>, @guaranteed Foo) -> ()
// CHECK: return [[RESULT]] : $()
}
@@ -23,8 +23,8 @@ import gizmo
// CHECK-LABEL: sil hidden @_TToFC24objc_dictionary_bridging3Foo24bridge_Dictionary_result{{.*}} : $@cc(objc_method) @thin (Foo) -> @autoreleased NSDictionary
func bridge_Dictionary_result() -> Dictionary<Foo, Foo> {
// CHECK: bb0([[SELF:%[0-9]+]] : $Foo):
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC24objc_dictionary_bridging3Foo24bridge_Dictionary_result{{.*}} : $@cc(method) @thin (@owned Foo) -> @owned Dictionary<Foo, Foo>
// CHECK-NEXT: [[DICT:%[0-9]+]] = apply [[SWIFT_FN]]([[SELF]]) : $@cc(method) @thin (@owned Foo) -> @owned Dictionary<Foo, Foo>
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC24objc_dictionary_bridging3Foo24bridge_Dictionary_result{{.*}} : $@cc(method) @thin (@guaranteed Foo) -> @owned Dictionary<Foo, Foo>
// CHECK-NEXT: [[DICT:%[0-9]+]] = apply [[SWIFT_FN]]([[SELF]]) : $@cc(method) @thin (@guaranteed Foo) -> @owned Dictionary<Foo, Foo>
// CHECK: [[CONVERTER:%[0-9]+]] = function_ref @_TF10Foundation32_convertDictionaryToNSDictionary{{.*}} : $@thin <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@owned Dictionary<τ_0_0, τ_0_1>) -> @owned NSDictionary
// CHECK-NEXT: [[NSDICT:%[0-9]+]] = apply [[CONVERTER]]<Foo, Foo>([[DICT]]) : $@thin <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@owned Dictionary<τ_0_0, τ_0_1>) -> @owned NSDictionary
@@ -36,8 +36,8 @@ import gizmo
// Property getter
// CHECK-LABEL: sil hidden [transparent] @_TToFC24objc_dictionary_bridging3Foog8propertyGVSs10DictionaryS0_S0__ : $@cc(objc_method) @thin (Foo) -> @autoreleased NSDictionary
// CHECK: bb0([[SELF:%[0-9]+]] : $Foo):
// CHECK: [[GETTER:%[0-9]+]] = function_ref @_TFC24objc_dictionary_bridging3Foog8propertyGVSs10DictionaryS0_S0__ : $@cc(method) @thin (@owned Foo) -> @owned Dictionary<Foo, Foo>
// CHECK: [[DICT:%[0-9]+]] = apply [[GETTER]]([[SELF]]) : $@cc(method) @thin (@owned Foo) -> @owned Dictionary<Foo, Foo>
// CHECK: [[GETTER:%[0-9]+]] = function_ref @_TFC24objc_dictionary_bridging3Foog8propertyGVSs10DictionaryS0_S0__ : $@cc(method) @thin (@guaranteed Foo) -> @owned Dictionary<Foo, Foo>
// CHECK: [[DICT:%[0-9]+]] = apply [[GETTER]]([[SELF]]) : $@cc(method) @thin (@guaranteed Foo) -> @owned Dictionary<Foo, Foo>
// CHECK: [[CONVERTER:%[0-9]+]] = function_ref @_TF10Foundation32_convertDictionaryToNSDictionary{{.*}} : $@thin <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@owned Dictionary<τ_0_0, τ_0_1>) -> @owned NSDictionary
// CHECK: [[NSDICT:%[0-9]+]] = apply [[CONVERTER]]<Foo, Foo>([[DICT]]) : $@thin <τ_0_0, τ_0_1 where τ_0_0 : Hashable> (@owned Dictionary<τ_0_0, τ_0_1>) -> @owned NSDictionary
@@ -50,8 +50,8 @@ import gizmo
// CHECK: [[OPT_NSDICT:%[0-9]+]] = enum $Optional<NSDictionary>, #Optional.Some!enumelt.1, [[NSDICT]] : $NSDictionary
// CHECK: [[DICT:%[0-9]+]] = apply [[CONVERTER]]<Foo, Foo>([[OPT_NSDICT]]) : $@thin <τ_0_0, τ_0_1 where τ_0_0 : NSObject, τ_0_0 : Hashable, τ_0_1 : AnyObject> (@owned Optional<NSDictionary>) -> @owned Dictionary<τ_0_0, τ_0_1>
// CHECK: [[SETTER:%[0-9]+]] = function_ref @_TFC24objc_dictionary_bridging3Foos8propertyGVSs10DictionaryS0_S0__ : $@cc(method) @thin (@owned Dictionary<Foo, Foo>, @owned Foo) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SETTER]]([[DICT]], [[SELF]]) : $@cc(method) @thin (@owned Dictionary<Foo, Foo>, @owned Foo) -> ()
// CHECK: [[SETTER:%[0-9]+]] = function_ref @_TFC24objc_dictionary_bridging3Foos8propertyGVSs10DictionaryS0_S0__ : $@cc(method) @thin (@owned Dictionary<Foo, Foo>, @guaranteed Foo) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SETTER]]([[DICT]], [[SELF]]) : $@cc(method) @thin (@owned Dictionary<Foo, Foo>, @guaranteed Foo) -> ()
// CHECK: return [[RESULT]] : $()
// CHECK-LABEL: sil hidden [transparent] @_TToFC24objc_dictionary_bridging3Foog19nonVerbatimProperty{{.*}} : $@cc(objc_method) @thin (Foo) -> @autoreleased NSDictionary

View File

@@ -16,7 +16,7 @@ class A {
// CHECK: [[M_AS_THICK:%[0-9]+]] = objc_to_thick_metatype [[M]] : $@objc_metatype ObjCClass.Type to $@thick ObjCClass.Type
// CHECK: [[NATIVE_FOO:%[0-9]+]] = function_ref @_TFC14objc_metatypes1A3foo
// CHECK: [[NATIVE_RESULT:%[0-9]+]] = apply [[NATIVE_FOO]]([[M_AS_THICK]], [[SELF]]) : $@cc(method) @thin (@thick ObjCClass.Type, @owned A) -> @thick ObjCClass.Type
// CHECK: [[NATIVE_RESULT:%[0-9]+]] = apply [[NATIVE_FOO]]([[M_AS_THICK]], [[SELF]]) : $@cc(method) @thin (@thick ObjCClass.Type, @guaranteed A) -> @thick ObjCClass.Type
// CHECK: [[OBJC_RESULT:%[0-9]+]] = thick_to_objc_metatype [[NATIVE_RESULT]] : $@thick ObjCClass.Type to $@objc_metatype ObjCClass.Type
// CHECK: return [[OBJC_RESULT]] : $@objc_metatype ObjCClass.Type
return m

View File

@@ -47,7 +47,7 @@ class A {
other.prop = x
}
// CHECK-LABEL: sil hidden @_TFC15objc_properties1Ad : $@cc(method) @thin (@owned A) -> @owned Builtin.NativeObject {
// CHECK-LABEL: sil hidden @_TFC15objc_properties1Ad : $@cc(method) @thin (@guaranteed A) -> @owned Builtin.NativeObject {
// CHECK-NOT: class_method {{.*}} #A.prop
// CHECK: }
deinit {
@@ -84,12 +84,12 @@ func testComputedPropSet(a: A, i: Int) {
// 'super' property references.
class B : A {
@objc override var computedProp: Int {
// CHECK-LABEL: sil hidden @_TFC15objc_properties1Bg12computedPropSi : $@cc(method) @thin (@owned B) -> Int
// CHECK-LABEL: sil hidden @_TFC15objc_properties1Bg12computedPropSi : $@cc(method) @thin (@guaranteed B) -> Int
get {
// CHECK: super_method [volatile] [[SELF:%[0-9]+]] : $B, #A.computedProp!getter.1.foreign : A -> () -> Int , $@cc(objc_method) @thin (A) -> Int
return super.computedProp
}
// CHECK-LABEL: sil hidden @_TFC15objc_properties1Bs12computedPropSi : $@cc(method) @thin (Int, @owned B) -> ()
// CHECK-LABEL: sil hidden @_TFC15objc_properties1Bs12computedPropSi : $@cc(method) @thin (Int, @guaranteed B) -> ()
set(value) {
// CHECK: super_method [volatile] [[SELF:%[0-9]+]] : $B, #A.computedProp!setter.1.foreign : A -> (Int) -> () , $@cc(objc_method) @thin (Int, A) -> ()
super.computedProp = value
@@ -101,7 +101,7 @@ class B : A {
// Test the @NSCopying attribute.
class TestNSCopying {
// CHECK: // objc_properties.TestNSCopying.property.setter : ObjectiveC.NSString
// CHECK-NEXT: sil hidden [transparent] @_TFC15objc_properties13TestNSCopyings8propertyCSo8NSString : $@cc(method) @thin (@owned NSString, @owned TestNSCopying) -> ()
// CHECK-NEXT: sil hidden [transparent] @_TFC15objc_properties13TestNSCopyings8propertyCSo8NSString : $@cc(method) @thin (@owned NSString, @guaranteed TestNSCopying) -> ()
// CHECK-NEXT: bb0(%0 : $NSString, %1 : $TestNSCopying):
// CHECK: class_method [volatile] %0 : $NSString, #NSString.copyWithZone!1.foreign
@NSCopying var property : NSString

View File

@@ -15,8 +15,8 @@ import gizmo
// CHECK: [[CONVERTER:%[0-9]+]] = function_ref @_TF10Foundation18_convertNSSetToSet{{.*}} : $@thin <τ_0_0 where τ_0_0 : NSObject, τ_0_0 : Hashable> (@owned Optional<NSSet>) -> @owned Set<τ_0_0>
// CHECK: [[OPT_NSSET:%[0-9]+]] = enum $Optional<NSSet>, #Optional.Some!enumelt.1, [[NSSET]] : $NSSet
// CHECK: [[SET:%[0-9]+]] = apply [[CONVERTER]]<Foo>([[OPT_NSSET]]) : $@thin <τ_0_0 where τ_0_0 : NSObject, τ_0_0 : Hashable> (@owned Optional<NSSet>) -> @owned Set<τ_0_0>
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC17objc_set_bridging3Foo16bridge_Set_param{{.*}} : $@cc(method) @thin (@owned Set<Foo>, @owned Foo) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SWIFT_FN]]([[SET]], [[SELF]]) : $@cc(method) @thin (@owned Set<Foo>, @owned Foo) -> ()
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC17objc_set_bridging3Foo16bridge_Set_param{{.*}} : $@cc(method) @thin (@owned Set<Foo>, @guaranteed Foo) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SWIFT_FN]]([[SET]], [[SELF]]) : $@cc(method) @thin (@owned Set<Foo>, @guaranteed Foo) -> ()
// CHECK: return [[RESULT]] : $()
}
@@ -25,8 +25,8 @@ import gizmo
func bridge_Set_result() -> Set<Foo> {
// CHECK: bb0([[SELF:%[0-9]+]] : $Foo):
// CHECK: strong_retain [[SELF]] : $Foo
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC17objc_set_bridging3Foo17bridge_Set_result{{.*}} : $@cc(method) @thin (@owned Foo) -> @owned Set<Foo>
// CHECK: [[SET:%[0-9]+]] = apply [[SWIFT_FN]]([[SELF]]) : $@cc(method) @thin (@owned Foo) -> @owned Set<Foo>
// CHECK: [[SWIFT_FN:%[0-9]+]] = function_ref @_TFC17objc_set_bridging3Foo17bridge_Set_result{{.*}} : $@cc(method) @thin (@guaranteed Foo) -> @owned Set<Foo>
// CHECK: [[SET:%[0-9]+]] = apply [[SWIFT_FN]]([[SELF]]) : $@cc(method) @thin (@guaranteed Foo) -> @owned Set<Foo>
// CHECK: [[CONVERTER:%[0-9]+]] = function_ref @_TF10Foundation18_convertSetToNSSet{{.*}} : $@thin <τ_0_0 where τ_0_0 : Hashable> (@owned Set<τ_0_0>) -> @owned NSSet
// CHECK: [[NSSET:%[0-9]+]] = apply [[CONVERTER]]<Foo>([[SET]]) : $@thin <τ_0_0 where τ_0_0 : Hashable> (@owned Set<τ_0_0>) -> @owned NSSet
// CHECK: autorelease_return [[NSSET]] : $NSSet
@@ -38,8 +38,8 @@ import gizmo
// CHECK-LABEL: sil hidden [transparent] @_TToFC17objc_set_bridging3Foog8property{{.*}} : $@cc(objc_method) @thin (Foo) -> @autoreleased NSSet
// CHECK: bb0([[SELF:%[0-9]+]] : $Foo):
// CHECK: strong_retain [[SELF]] : $Foo
// CHECK: [[GETTER:%[0-9]+]] = function_ref @_TFC17objc_set_bridging3Foog8property{{.*}} : $@cc(method) @thin (@owned Foo) -> @owned Set<Foo>
// CHECK: [[SET:%[0-9]+]] = apply [[GETTER]]([[SELF]]) : $@cc(method) @thin (@owned Foo) -> @owned Set<Foo>
// CHECK: [[GETTER:%[0-9]+]] = function_ref @_TFC17objc_set_bridging3Foog8property{{.*}} : $@cc(method) @thin (@guaranteed Foo) -> @owned Set<Foo>
// CHECK: [[SET:%[0-9]+]] = apply [[GETTER]]([[SELF]]) : $@cc(method) @thin (@guaranteed Foo) -> @owned Set<Foo>
// CHECK: [[CONVERTER:%[0-9]+]] = function_ref @_TF10Foundation18_convertSetToNSSet{{.*}} : $@thin <τ_0_0 where τ_0_0 : Hashable> (@owned Set<τ_0_0>) -> @owned NSSet
// CHECK: [[NSSET:%[0-9]+]] = apply [[CONVERTER]]<Foo>([[SET]]) : $@thin <τ_0_0 where τ_0_0 : Hashable> (@owned Set<τ_0_0>) -> @owned NSSet
// CHECK: autorelease_return [[NSSET]] : $NSSet
@@ -52,8 +52,9 @@ import gizmo
// CHECK: [[CONVERTER:%[0-9]+]] = function_ref @_TF10Foundation18_convertNSSetToSet{{.*}} : $@thin <τ_0_0 where τ_0_0 : NSObject, τ_0_0 : Hashable> (@owned Optional<NSSet>) -> @owned Set<τ_0_0>
// CHECK: [[OPT_NSSET:%[0-9]+]] = enum $Optional<NSSet>, #Optional.Some!enumelt.1, [[NSSET]] : $NSSet
// CHECK: [[SET:%[0-9]+]] = apply [[CONVERTER]]<Foo>([[OPT_NSSET]]) : $@thin <τ_0_0 where τ_0_0 : NSObject, τ_0_0 : Hashable> (@owned Optional<NSSet>) -> @owned Set<τ_0_0>
// CHECK: [[SETTER:%[0-9]+]] = function_ref @_TFC17objc_set_bridging3Foos8property{{.*}} : $@cc(method) @thin (@owned Set<Foo>, @owned Foo) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SETTER]]([[SET]], [[SELF]]) : $@cc(method) @thin (@owned Set<Foo>, @owned Foo) -> ()
// CHECK: [[SETTER:%[0-9]+]] = function_ref @_TFC17objc_set_bridging3Foos8property{{.*}} : $@cc(method) @thin (@owned Set<Foo>, @guaranteed Foo) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SETTER]]([[SET]], [[SELF]]) : $@cc(method) @thin (@owned Set<Foo>, @guaranteed Foo) -> ()
// CHECK: strong_release [[SELF]] : $Foo
// CHECK: return [[RESULT]] : $()
// CHECK-LABEL: sil hidden [transparent] @_TToFC17objc_set_bridging3Foog19nonVerbatimProperty{{.*}} : $@cc(objc_method) @thin (Foo) -> @autoreleased NSSet

View File

@@ -28,12 +28,12 @@ func testSubscriptSet(a: A, i: Int, v: ObjCClass) {
// 'super' subscript usage
class B : A {
@objc override subscript (i: Int) -> ObjCClass {
// CHECK-LABEL: sil hidden @_TFC14objc_subscript1Bg9subscriptFSiCS_9ObjCClass : $@cc(method) @thin (Int, @owned B) -> @owned ObjCClass
// CHECK-LABEL: sil hidden @_TFC14objc_subscript1Bg9subscriptFSiCS_9ObjCClass : $@cc(method) @thin (Int, @guaranteed B) -> @owned ObjCClass
get {
// CHECK: super_method [volatile] [[SELF:%[0-9]+]] : $B, #A.subscript!getter.1.foreign : A -> (Int) -> ObjCClass , $@cc(objc_method) @thin (Int, A) -> @autoreleased ObjCClass
return super[i]
}
// CHECK-LABEL: sil hidden @_TFC14objc_subscript1Bs9subscriptFSiCS_9ObjCClass : $@cc(method) @thin (@owned ObjCClass, Int, @owned B) -> ()
// CHECK-LABEL: sil hidden @_TFC14objc_subscript1Bs9subscriptFSiCS_9ObjCClass : $@cc(method) @thin (@owned ObjCClass, Int, @guaranteed B) -> ()
set(value) {
// CHECK: super_method [volatile] [[SELF:%[0-9]+]] : $B, #A.subscript!setter.1.foreign : A -> (ObjCClass, Int) -> () , $@cc(objc_method) @thin (ObjCClass, Int, A) -> ()
super[i] = value

View File

@@ -20,7 +20,7 @@ class Hoozit : Gizmo {
super.runce()
}
// CHECK-LABEL: sil hidden @_TFC10objc_super6Hoozit4frobfS0_FT_T_ : $@cc(method) @thin (@owned Hoozit) -> ()
// CHECK-LABEL: sil hidden @_TFC10objc_super6Hoozit4frobfS0_FT_T_ : $@cc(method) @thin (@guaranteed Hoozit) -> ()
override func frob() {
// CHECK: super_method [volatile] {{%.*}} : $Hoozit, #Gizmo.frob!1.foreign
super.frob()

View File

@@ -11,9 +11,10 @@ class Hoozit : Gizmo {
// CHECK-NEXT: retain [[Y]]
// CHECK-NEXT: retain [[THIS]]
// CHECK-NEXT: // function_ref
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozit7typicalfS0_FTSi1yCSo5Gizmo_S1_ : $@cc(method) @thin (Int, @owned Gizmo, @owned Hoozit) -> @owned Gizmo
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozit7typicalfS0_FTSi1yCSo5Gizmo_S1_ : $@cc(method) @thin (Int, @owned Gizmo, @guaranteed Hoozit) -> @owned Gizmo
// CHECK-NEXT: [[RES:%.*]] = apply [[NATIVE]]([[X]], [[Y]], [[THIS]]) {{.*}} line:[[@LINE-7]]:8:auto_gen
// CHECK-NEXT: autorelease_return [[RES]] : $Gizmo // {{.*}} line:[[@LINE-8]]:8:auto_gen
// CHECK-NEXT: strong_release [[THIS]] : $Hoozit // {{.*}}
// CHECK-NEXT: autorelease_return [[RES]] : $Gizmo // {{.*}} line:[[@LINE-9]]:8:auto_gen
// CHECK-NEXT: }
// NS_CONSUMES_SELF by inheritance
@@ -21,8 +22,9 @@ class Hoozit : Gizmo {
// CHECK-LABEL: sil hidden @_TToFC11objc_thunks6Hoozit4forkfS0_FT_T_ : $@cc(objc_method) @thin (@owned Hoozit) -> () {
// CHECK-NEXT: bb0([[THIS:%.*]] : $Hoozit):
// CHECK-NEXT: // function_ref
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozit4forkfS0_FT_T_ : $@cc(method) @thin (@owned Hoozit) -> ()
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozit4forkfS0_FT_T_ : $@cc(method) @thin (@guaranteed Hoozit) -> ()
// CHECK-NEXT: apply [[NATIVE]]([[THIS]])
// CHECK-NEXT: strong_release [[THIS]]
// CHECK-NEXT: return
// CHECK-NEXT: }
@@ -42,10 +44,10 @@ class Hoozit : Gizmo {
// CHECK-NEXT: bb0([[THIS:%.*]] : $Hoozit):
// CHECK-NEXT: retain [[THIS]]
// CHECK-NEXT: // function_ref
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozit7copyFoofS0_FT_CSo5Gizmo : $@cc(method) @thin (@owned Hoozit) -> @owned Gizmo
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozit7copyFoofS0_FT_CSo5Gizmo : $@cc(method) @thin (@guaranteed Hoozit) -> @owned Gizmo
// CHECK-NEXT: [[RES:%.*]] = apply [[NATIVE]]([[THIS]])
// CHECK: release [[THIS]]
// CHECK-NOT: autorelease_return
// CHECK-NOT: release
// CHECK-NEXT: return [[RES]]
// CHECK-NEXT: }
@@ -57,16 +59,16 @@ class Hoozit : Gizmo {
// CHECK-NEXT: // function_ref objc_thunks.Hoozit.typicalProperty.getter
// CHECK-NEXT: [[GETIMPL:%.*]] = function_ref @_TFC11objc_thunks6Hoozitg15typicalPropertyCSo5Gizmo
// CHECK-NEXT: [[RES:%.*]] = apply [[GETIMPL]](%0)
// CHECK-NEXT: strong_release %0
// CHECK-NEXT: autorelease_return [[RES]] : $Gizmo
// CHECK-NEXT: }
// CHECK-LABEL: sil hidden [transparent] @_TFC11objc_thunks6Hoozitg15typicalPropertyCSo5Gizmo
// CHECK-LABEL: sil hidden [transparent] @_TFC11objc_thunks6Hoozitg15typicalPropertyCSo5Gizmo : $@cc(method) @thin (@guaranteed Hoozit) -> @owned Gizmo
// CHECK-NEXT: bb0(%0 : $Hoozit):
// CHECK-NEXT: debug_value %0
// CHECK-NEXT: [[ADDR:%.*]] = ref_element_addr %0 : {{.*}}, #Hoozit.typicalProperty {{.*}}
// CHECK-NEXT: [[RES:%.*]] = load [[ADDR]] {{.*}}
// CHECK-NEXT: strong_retain [[RES]] : $Gizmo
// CHECK-NEXT: strong_release %0 : $Hoozit
// CHECK-NEXT: return [[RES]]
// -- setter
@@ -93,6 +95,7 @@ class Hoozit : Gizmo {
// CHECK-NEXT: // function_ref objc_thunks.Hoozit.copyProperty.getter
// CHECK-NEXT: [[FR:%.*]] = function_ref @_TFC11objc_thunks6Hoozitg12copyPropertyCSo5Gizmo
// CHECK-NEXT: [[RES:%.*]] = apply [[FR]](%0)
// CHECK-NEXT: strong_release %0
// CHECK-NEXT: return [[RES]]
// CHECK-NEXT: }
@@ -101,7 +104,6 @@ class Hoozit : Gizmo {
// CHECK: [[ADDR:%.*]] = ref_element_addr %0 : {{.*}}, #Hoozit.copyProperty
// CHECK-NEXT: [[RES:%.*]] = load [[ADDR]]
// CHECK-NEXT: retain [[RES]]
// CHECK-NEXT: release %0
// CHECK-NEXT: return [[RES]]
// -- setter is normal
@@ -112,6 +114,7 @@ class Hoozit : Gizmo {
// CHECK-NEXT: // function_ref objc_thunks.Hoozit.copyProperty.setter
// CHECK-NEXT: [[FR:%.*]] = function_ref @_TFC11objc_thunks6Hoozits12copyPropertyCSo5Gizmo
// CHECK-NEXT: [[RES:%.*]] = apply [[FR]](%0, %1)
// CHECK-NEXT: strong_release [[THIS]]
// CHECK-NEXT: return [[RES]]
// CHECK-LABEL: sil hidden [transparent] @_TFC11objc_thunks6Hoozits12copyPropertyCSo5Gizmo
@@ -125,8 +128,9 @@ class Hoozit : Gizmo {
// CHECK-NEXT: bb0([[THIS:%.*]] : $Hoozit):
// CHECK-NEXT: retain [[THIS]]
// CHECK-NEXT: // function_ref
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozitg10roPropertyCSo5Gizmo : $@cc(method) @thin (@owned Hoozit) -> @owned Gizmo
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozitg10roPropertyCSo5Gizmo : $@cc(method) @thin (@guaranteed Hoozit) -> @owned Gizmo
// CHECK-NEXT: [[RES:%.*]] = apply [[NATIVE]]([[THIS]])
// CHECK-NEXT: release [[THIS]] : $Hoozit
// CHECK-NEXT: autorelease_return [[RES]] : $Gizmo
// CHECK-NEXT: }
@@ -148,8 +152,9 @@ class Hoozit : Gizmo {
// CHECK-NEXT: retain [[VALUE]]
// CHECK-NEXT: retain [[THIS]]
// CHECK-NEXT: // function_ref
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozits10rwPropertyCSo5Gizmo : $@cc(method) @thin (@owned Gizmo, @owned Hoozit) -> ()
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozits10rwPropertyCSo5Gizmo : $@cc(method) @thin (@owned Gizmo, @guaranteed Hoozit) -> ()
// CHECK-NEXT: apply [[NATIVE]]([[VALUE]], [[THIS]])
// CHECK-NEXT: release [[THIS]]
// CHECK-NEXT: return
// CHECK-NEXT: }
@@ -164,9 +169,9 @@ class Hoozit : Gizmo {
// CHECK-NEXT: bb0([[THIS:%.*]] : $Hoozit):
// CHECK-NEXT: retain [[THIS]]
// CHECK-NEXT: // function_ref
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozitg14copyRWPropertyCSo5Gizmo : $@cc(method) @thin (@owned Hoozit) -> @owned Gizmo
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozitg14copyRWPropertyCSo5Gizmo : $@cc(method) @thin (@guaranteed Hoozit) -> @owned Gizmo
// CHECK-NEXT: [[RES:%.*]] = apply [[NATIVE]]([[THIS]])
// CHECK-NOT: release
// CHECK-NEXT: release [[THIS]]
// CHECK-NOT: autorelease_return
// CHECK-NEXT: return [[RES]]
// CHECK-NEXT: }
@@ -177,8 +182,9 @@ class Hoozit : Gizmo {
// CHECK-NEXT: retain [[VALUE]]
// CHECK-NEXT: retain [[THIS]]
// CHECK-NEXT: // function_ref
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozits14copyRWPropertyCSo5Gizmo : $@cc(method) @thin (@owned Gizmo, @owned Hoozit) -> ()
// CHECK-NEXT: [[NATIVE:%.*]] = function_ref @_TFC11objc_thunks6Hoozits14copyRWPropertyCSo5Gizmo : $@cc(method) @thin (@owned Gizmo, @guaranteed Hoozit) -> ()
// CHECK-NEXT: apply [[NATIVE]]([[VALUE]], [[THIS]])
// CHECK-NEXT: release [[THIS]]
// CHECK-NEXT: return
// CHECK-NEXT: }
@@ -220,8 +226,9 @@ class Hoozit : Gizmo {
// CHECK-LABEL: sil hidden @_TToFC11objc_thunks6Hoozitg9subscriptFSiS0_ : $@cc(objc_method) @thin (Int, Hoozit) -> @autoreleased Hoozit
// CHECK-NEXT: bb0([[I:%[0-9]+]] : $Int, [[SELF:%[0-9]+]] : $Hoozit):
// CHECK-NEXT: strong_retain [[SELF]] : $Hoozit
// CHECK: [[NATIVE:%[0-9]+]] = function_ref @_TFC11objc_thunks6Hoozitg9subscript{{.*}} : $@cc(method) @thin (Int, @owned Hoozit) -> @owned Hoozit
// CHECK-NEXT: [[RESULT:%[0-9]+]] = apply [[NATIVE]]([[I]], [[SELF]]) : $@cc(method) @thin (Int, @owned Hoozit) -> @owned Hoozit
// CHECK: [[NATIVE:%[0-9]+]] = function_ref @_TFC11objc_thunks6Hoozitg9subscript{{.*}} : $@cc(method) @thin (Int, @guaranteed Hoozit) -> @owned Hoozit
// CHECK-NEXT: [[RESULT:%[0-9]+]] = apply [[NATIVE]]([[I]], [[SELF]]) : $@cc(method) @thin (Int, @guaranteed Hoozit) -> @owned Hoozit
// CHECK-NEXT: strong_release [[SELF]]
// CHECK-NEXT: autorelease_return [[RESULT]] : $Hoozit
get {
return self
@@ -232,8 +239,9 @@ class Hoozit : Gizmo {
// CHECK-NEXT: bb0([[SELF:%[0-9]+]] : $Hoozit, [[I:%[0-9]+]] : $Int, [[VALUE:%[0-9]+]] : $Hoozit):
// CHECK-NEXT: strong_retain [[SELF]] : $Hoozit
// CHECK_NEXT: strong_retain [[VALUE]] : $Hoozit
// CHECK: [[NATIVE:%[0-9]+]] = function_ref @_TFC11objc_thunks6Hoozits9subscript{{.*}} : $@cc(method) @thin (@owned Hoozit, Int, @owned Hoozit) -> ()
// CHECK-NEXT: [[RESULT:%[0-9]+]] = apply [[NATIVE]]([[SELF]], [[I]], [[VALUE]]) : $@cc(method) @thin (@owned Hoozit, Int, @owned Hoozit) -> ()
// CHECK: [[NATIVE:%[0-9]+]] = function_ref @_TFC11objc_thunks6Hoozits9subscript{{.*}} : $@cc(method) @thin (@owned Hoozit, Int, @guaranteed Hoozit) -> ()
// CHECK-NEXT: [[RESULT:%[0-9]+]] = apply [[NATIVE]]([[SELF]], [[I]], [[VALUE]]) : $@cc(method) @thin (@owned Hoozit, Int, @guaranteed Hoozit) -> ()
// CHECK-NEXT: strong_release [[VALUE]]
// CHECK-NEXT: return [[RESULT]] : $()
set {}
}
@@ -295,7 +303,7 @@ extension Hoozit {
// CHECK-LABEL: sil hidden @_TToFC11objc_thunks6Hoozit4fooffS0_FT_T_ : $@cc(objc_method) @thin (Hoozit) -> () {
var extensionProperty: Int { return 0 }
// CHECK-LABEL: sil hidden @_TFC11objc_thunks6Hoozitg17extensionPropertySi : $@cc(method) @thin (@owned Hoozit) -> Int
// CHECK-LABEL: sil hidden @_TFC11objc_thunks6Hoozitg17extensionPropertySi : $@cc(method) @thin (@guaranteed Hoozit) -> Int
}
// Calling objc methods of subclass should go through native entry points

View File

@@ -22,9 +22,17 @@ class Phoûx : NSObject, Fooable {
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWCSo3Foo14objc_witnesses7FooableS0_FS1_3fooUS1___fQPS1_FT_GSQSS_
// CHECK: function_ref @_TTOFCSo3Foo3foofS_FT_GSQSS_
// *NOTE* We have an extra copy here for the time being right
// now. This will change once we teach SILGen how to not emit the
// extra copy.
//
// witness for Phoûx.foo uses the Swift vtable
// CHECK-LABEL: _TTWC14objc_witnessesX8Phox_xraS_7FooableS_FS1_3fooUS1___fQPS1_FT_GSQSS_
// CHECK: class_method %1 : $Phoûx, #Phoûx.foo!1
// CHECK: bb0([[IN_ADDR:%.*]] :
// CHECK: [[STACK_SLOT:%.*]] = alloc_stack $Phoûx
// CHECK: copy_addr [[IN_ADDR]] to [initialization] [[STACK_SLOT]]#1
// CHECK: [[VALUE:%.*]] = load [[STACK_SLOT]]#1
// CHECK: class_method [[VALUE]] : $Phoûx, #Phoûx.foo!1
protocol Bells {
init(bellsOn: Int)

View File

@@ -101,9 +101,8 @@ func physical_struct_lvalue(c: Int) {
func physical_class_lvalue(r: Ref, a: Int) {
r.y = a
// CHECK: strong_retain %0 : $Ref
// CHECK: [[FN:%[0-9]+]] = class_method %0 : $Ref, #Ref.y!setter.1
// CHECK: apply [[FN]](%1, %0) : $@cc(method) @thin (Int, @owned Ref) -> ()
// CHECK: apply [[FN]](%1, %0) : $@cc(method) @thin (Int, @guaranteed Ref) -> ()
// CHECK: strong_release %0 : $Ref
}
@@ -111,16 +110,15 @@ func physical_struct_lvalue(c: Int) {
// CHECK-LABEL: sil hidden @_TF10properties24physical_subclass_lvalue
func physical_subclass_lvalue(r: RefSubclass, a: Int) {
r.y = a
// CHECK: strong_retain %0 : $RefSubclass
// strong_retain %0 : $RefSubclass
// CHECK: [[R_SUP:%[0-9]+]] = upcast %0 : $RefSubclass to $Ref
// CHECK: [[FN:%[0-9]+]] = class_method [[R_SUP]] : $Ref, #Ref.y!setter.1 : Ref
// CHECK: [[FN:%[0-9]+]] = class_method [[R_SUP]] : $Ref, #Ref.y!setter.1 : Ref -> (Int) -> () , $@cc(method) @thin (Int, @guaranteed Ref) -> ()
// CHECK: apply [[FN]](%1, [[R_SUP]]) :
// CHECK: strong_release [[R_SUP]]
r.w = a
// CHECK: strong_retain %0 : $RefSubclass
// CHECK: [[FN:%[0-9]+]] = class_method %0 : $RefSubclass, #RefSubclass.w!setter.1
// CHECK: apply [[FN]](%1, %0) : $@cc(method) @thin (Int, @owned RefSubclass) -> ()
// CHECK: apply [[FN]](%1, %0) : $@cc(method) @thin (Int, @guaranteed RefSubclass) -> ()
}
@@ -337,9 +335,8 @@ func physical_inout(var x: Int) {
// CHECK-NEXT: bb0([[VVAL:%[0-9]+]] : $Val, [[I:%[0-9]+]] : $Int):
func val_subscript_get(v: Val, i: Int) -> Float {
return v[i]
// CHECK: retain_value [[VVAL]]
// CHECK: [[SUBSCRIPT_GET_METHOD:%[0-9]+]] = function_ref @_TFV10properties3Valg9subscript
// CHECK: [[RET:%[0-9]+]] = apply [[SUBSCRIPT_GET_METHOD]]([[I]], [[VVAL]])
// CHECK: [[RET:%[0-9]+]] = apply [[SUBSCRIPT_GET_METHOD]]([[I]], [[VVAL]]) : $@cc(method) @thin (Int, @guaranteed Val)
// CHECK: return [[RET]]
}
@@ -707,7 +704,7 @@ class DerivedProperty : BaseProperty {
// CHECK: [[BASEPTR:%[0-9]+]] = upcast %0 : $DerivedProperty to $BaseProperty
// CHECK: // function_ref properties.BaseProperty.x.getter
// CHECK: [[FN:%[0-9]+]] = function_ref @_TFC10properties12BasePropertyg1x
// CHECK: apply [[FN]]([[BASEPTR]]) : $@cc(method) @thin (@owned BaseProperty) -> Int // user: %7
// CHECK: apply [[FN]]([[BASEPTR]]) : $@cc(method) @thin (@guaranteed BaseProperty) -> Int // user: %7
// <rdar://problem/16411449> ownership qualifiers don't work with non-mutating struct property
@@ -723,7 +720,6 @@ struct ReferenceStorageTypeRValues {
// CHECK-NEXT: %2 = struct_extract %0 : $ReferenceStorageTypeRValues, #ReferenceStorageTypeRValues.p1
// CHECK-NEXT: strong_retain_unowned %2 : $@sil_unowned Ref
// CHECK-NEXT: %4 = unowned_to_ref %2 : $@sil_unowned Ref to $Ref
// CHECK-NEXT: release_value %0 : $ReferenceStorageTypeRValues
// CHECK-NEXT: return %4 : $Ref
init() {
@@ -875,7 +871,6 @@ class ClassWithLetProperty {
// CHECK-NEXT: debug_value
// CHECK-NEXT: [[PTR:%[0-9]+]] = ref_element_addr %0 : $ClassWithLetProperty, #ClassWithLetProperty.p
// CHECK-NEXT: [[VAL:%[0-9]+]] = load [[PTR]] : $*Int
// CHECK-NEXT: strong_release %0 : $ClassWithLetProperty
// CHECK-NEXT: return [[VAL]] : $Int
@@ -971,11 +966,11 @@ func addressOnlyNonmutatingProperty<T>(x: AddressOnlyNonmutatingSet<T>)
// CHECK-LABEL: sil hidden @_TF10properties30addressOnlyNonmutatingPropertyU__FGVS_25AddressOnlyNonmutatingSetQ__Si : $@thin <T> (@in AddressOnlyNonmutatingSet<T>) -> Int {
// CHECK: [[SET:%.*]] = function_ref @_TFV10properties25AddressOnlyNonmutatingSets4propSi
// CHECK: apply [[SET]]<T>({{%.*}}, [[TMP:%.*]]#1)
// CHECK-NOT: destroy_addr [[TMP]]
// CHECK: destroy_addr [[TMP]]
// CHECK: dealloc_stack [[TMP]]
// CHECK: [[GET:%.*]] = function_ref @_TFV10properties25AddressOnlyNonmutatingSetg4propSi
// CHECK: apply [[GET]]<T>([[TMP:%.*]]#1)
// CHECK-NOT: destroy_addr [[TMP]]
// CHECK: destroy_addr [[TMP]]
// CHECK: dealloc_stack [[TMP]]
protocol MakeAddressOnly {}

View File

@@ -6,7 +6,7 @@ public protocol P1 {
}
extension P1 {
// CHECK-LABEL: sil hidden @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ : $@cc(method) @thin <Self where Self : P1> (@in Self) -> () {
// CHECK-LABEL: sil hidden @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ : $@cc(method) @thin <Self where Self : P1> (@in_guaranteed Self) -> () {
// CHECK-NEXT: bb0([[SELF:%[0-9]+]] : $*Self):
final func extP1a() {
// CHECK: [[WITNESS:%[0-9]+]] = witness_method $Self, #P1.reqP1a!1 : $@cc(witness_method) @thin <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> ()
@@ -15,13 +15,11 @@ extension P1 {
// CHECK: return
}
// CHECK-LABEL: sil @_TFP19protocol_extensions2P16extP1bUS0___fQPS0_FT_T_ : $@cc(method) @thin <Self where Self : P1> (@in Self) -> () {
// CHECK-LABEL: sil @_TFP19protocol_extensions2P16extP1bUS0___fQPS0_FT_T_ : $@cc(method) @thin <Self where Self : P1> (@in_guaranteed Self) -> () {
// CHECK-NEXT: bb0([[SELF:%[0-9]+]] : $*Self):
public final func extP1b() {
// CHECK: [[FN:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in τ_0_0) -> ()
// CHECK-NEXT: [[SELF_COPY:%[0-9]+]] = alloc_stack $Self
// CHECK-NEXT: copy_addr [[SELF]] to [initialization] [[SELF_COPY]]#1 : $*Self
// CHECK-NEXT: apply [[FN]]<Self>([[SELF_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in τ_0_0) -> ()
// CHECK: [[FN:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> ()
// CHECK-NEXT: apply [[FN]]<Self>([[SELF]]) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> ()
extP1a()
// CHECK: return
}
@@ -44,7 +42,7 @@ func testD(d: D) {
// CHECK: [[DCOPY:%[0-9]+]] = alloc_stack $D
// CHECK: store [[D]] to [[DCOPY]]#1 : $*D
// CHECK: [[RESULT:%[0-9]+]] = alloc_stack $D
// CHECK: apply [[FN]]<D>([[RESULT]]#1, [[DCOPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@out τ_0_0, @in τ_0_0) -> ()
// CHECK: apply [[FN]]<D>([[RESULT]]#1, [[DCOPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@out τ_0_0, @in_guaranteed τ_0_0) -> ()
var d2: D = d.returnsSelf()
}
@@ -82,22 +80,19 @@ extension P1 {
func testExistentials1(p1: P1, b: Bool, i: Int64) {
// CHECK: [[POPENED:%[0-9]+]] = open_existential_addr [[P]] : $*P1 to $*@opened([[UUID:".*"]])
// CHECK: [[F1:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P12f1US0___fQPS0_FT_T_
// CHECK: copy_addr [[POPENED]] to [initialization] [[POPENED_COPY:%.*]]#1
// CHECK: apply [[F1]]<@opened([[UUID]]) P1>([[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in τ_0_0) -> ()
// CHECK: dealloc_stack [[POPENED_COPY]]
// CHECK: apply [[F1]]<@opened([[UUID]]) P1>([[POPENED]]) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> ()
p1.f1()
// CHECK: [[POPENED:%[0-9]+]] = open_existential_addr [[P]] : $*P1 to $*@opened([[UUID:".*"]]) P1
// CHECK: [[CURRIED1:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P18curried1US0___fQPS0_fSbFVSs5Int64T_
// CHECK: copy_addr [[POPENED]] to [initialization] [[POPENED_COPY:%.*]]#1
// CHECK: [[CURRIED1]]<@opened([[UUID]]) P1>([[I]], [[B]], [[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (Int64, Bool, @in τ_0_0) -> ()
// CHECK: dealloc_stack [[POPENED_COPY]]
// CHECK: [[CURRIED1]]<@opened([[UUID]]) P1>([[I]], [[B]], [[POPENED]]) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (Int64, Bool, @in_guaranteed τ_0_0) -> ()
p1.curried1(b)(i)
// CHECK: [[POPENED:%[0-9]+]] = open_existential_addr [[P]] : $*P1 to $*@opened([[UUID:".*"]]) P1
// CHECK: copy_addr [[POPENED]] to [initialization] [[POPENED_COPY:%.*]]#1
// CHECK: [[GETTER:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P1g9subscriptFVSs5Int64Sb
// CHECK: apply [[GETTER]]<@opened([[UUID]]) P1>([[I]], [[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (Int64, @in τ_0_0) -> Bool
// CHECK: apply [[GETTER]]<@opened([[UUID]]) P1>([[I]], [[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (Int64, @in_guaranteed τ_0_0) -> Bool
// CHECK: destroy_addr [[POPENED_COPY]]#1
// CHECK: store{{.*}} : $*Bool
// CHECK: dealloc_stack [[POPENED_COPY]]
var b2 = p1[i]
@@ -105,7 +100,7 @@ func testExistentials1(p1: P1, b: Bool, i: Int64) {
// CHECK: [[POPENED:%[0-9]+]] = open_existential_addr [[P]] : $*P1 to $*@opened([[UUID:".*"]]) P1
// CHECK: copy_addr [[POPENED]] to [initialization] [[POPENED_COPY:%.*]]#1
// CHECK: [[GETTER:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P1g4propSb
// CHECK: apply [[GETTER]]<@opened([[UUID]]) P1>([[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in τ_0_0) -> Bool
// CHECK: apply [[GETTER]]<@opened([[UUID]]) P1>([[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> Bool
// CHECK: store{{.*}} : $*Bool
// CHECK: dealloc_stack [[POPENED_COPY]]
var b3 = p1.prop
@@ -118,10 +113,8 @@ func testExistentials2(p1: P1) {
// CHECK: [[POPENED:%[0-9]+]] = open_existential_addr [[P]] : $*P1 to $*@opened([[UUID:".*"]]) P1
// CHECK: [[P1AINIT:%[0-9]+]] = init_existential_addr [[P1A]]#1 : $*P1, $@opened([[UUID2:".*"]]) P1
// CHECK: [[FN:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P111returnsSelfUS0___fQPS0_FT_S1_
// CHECK: copy_addr [[POPENED]] to [initialization] [[POPENED_COPY:%.*]]#1
// CHECK: apply [[FN]]<@opened([[UUID]]) P1>([[P1AINIT]], [[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@out τ_0_0, @in τ_0_0) -> ()
// CHECK: apply [[FN]]<@opened([[UUID]]) P1>([[P1AINIT]], [[POPENED]]) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@out τ_0_0, @in_guaranteed τ_0_0) -> ()
var p1a: P1 = p1.returnsSelf()
// CHECK: dealloc_stack [[POPENED_COPY]]#0
}
// CHECK-LABEL: sil hidden @_TF19protocol_extensions23testExistentialsGetters
@@ -130,13 +123,13 @@ func testExistentialsGetters(p1: P1) {
// CHECK: [[POPENED:%[0-9]+]] = open_existential_addr [[P]] : $*P1 to $*@opened([[UUID:".*"]]) P1
// CHECK: copy_addr [[POPENED]] to [initialization] [[POPENED_COPY:%.*]]#1
// CHECK: [[FN:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P1g5prop2Sb
// CHECK: [[B:%[0-9]+]] = apply [[FN]]<@opened([[UUID]]) P1>([[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in τ_0_0) -> Bool
// CHECK: [[B:%[0-9]+]] = apply [[FN]]<@opened([[UUID]]) P1>([[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> Bool
let b: Bool = p1.prop2
// CHECK: [[POPENED:%[0-9]+]] = open_existential_addr [[P]] : $*P1 to $*@opened([[UUID:".*"]]) P1
// CHECK: copy_addr [[POPENED]] to [initialization] [[POPENED_COPY:%.*]]#1
// CHECK: [[GETTER:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P1g9subscriptFSbSb
// CHECK: apply [[GETTER]]<@opened([[UUID]]) P1>([[B]], [[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (Bool, @in τ_0_0) -> Bool
// CHECK: apply [[GETTER]]<@opened([[UUID]]) P1>([[B]], [[POPENED_COPY]]#1) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (Bool, @in_guaranteed τ_0_0) -> Bool
let b2: Bool = p1[b]
}
@@ -177,8 +170,8 @@ func testLogicalExistentialSetters(var hasAP1: HasAP1, b: Bool) {
// CHECK: [[P1_COPY:%[0-9]+]] = alloc_stack $P1
// CHECK-NEXT: [[HASP1_COPY:%[0-9]+]] = alloc_stack $HasAP1
// CHECK-NEXT: copy_addr [[HASP1_BOX]]#1 to [initialization] [[HASP1_COPY]]#1 : $*HasAP1
// CHECK: [[SOMEP1_GETTER:%[0-9]+]] = function_ref @_TFV19protocol_extensions6HasAP1g6someP1PS_2P1_ : $@cc(method) @thin (@out P1, @in HasAP1) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SOMEP1_GETTER]]([[P1_COPY]]#1, %6#1) : $@cc(method) @thin (@out P1, @in HasAP1) -> ()
// CHECK: [[SOMEP1_GETTER:%[0-9]+]] = function_ref @_TFV19protocol_extensions6HasAP1g6someP1PS_2P1_ : $@cc(method) @thin (@out P1, @in_guaranteed HasAP1) -> ()
// CHECK: [[RESULT:%[0-9]+]] = apply [[SOMEP1_GETTER]]([[P1_COPY]]#1, %6#1) : $@cc(method) @thin (@out P1, @in_guaranteed HasAP1) -> ()
// CHECK: [[P1_OPENED:%[0-9]+]] = open_existential_addr [[P1_COPY]]#1 : $*P1 to $*@opened([[UUID:".*"]]) P1
// CHECK: [[PROP2_SETTER:%[0-9]+]] = function_ref @_TFP19protocol_extensions2P1s5prop2Sb : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (Bool, @inout τ_0_0) -> ()
// CHECK: apply [[PROP2_SETTER]]<@opened([[UUID]]) P1>([[B]], [[P1_OPENED]]) : $@cc(method) @thin <τ_0_0 where τ_0_0 : P1> (Bool, @inout τ_0_0) -> ()
@@ -200,12 +193,7 @@ func test_open_existential_semantics_opaque(guaranteed: P1,
// CHECK: [[VALUE:%.*]] = open_existential_addr %0
// CHECK: [[METHOD:%.*]] = function_ref
// CHECK: copy_addr [[VALUE]] to [initialization] [[COPY:%.*]]#1 :
// CHECK: apply [[METHOD]]<{{.*}}>([[COPY]]#1)
// CHECK-NOT: destroy_addr [[COPY]]#1
// CHECK: dealloc_stack [[COPY]]#0
// CHECK-NOT: destroy_addr [[VALUE]]
// CHECK-NOT: destroy_addr %0
// CHECK: apply [[METHOD]]<{{.*}}>([[VALUE]])
// GUARANTEED: [[VALUE:%.*]] = open_existential_addr %0
// GUARANTEED: [[METHOD:%.*]] = function_ref
@@ -268,7 +256,6 @@ func test_open_existential_semantics_class(guaranteed: CP1,
// CHECK-NOT: strong_retain %0
// CHECK: [[VALUE:%.*]] = open_existential_ref %0
// CHECK: [[METHOD:%.*]] = function_ref
// CHECK: strong_retain [[VALUE]]
// CHECK: apply [[METHOD]]<{{.*}}>([[VALUE]])
// CHECK-NOT: strong_release [[VALUE]]
// CHECK-NOT: strong_release %0
@@ -286,7 +273,7 @@ func test_open_existential_semantics_class(guaranteed: CP1,
// CHECK: [[VALUE:%.*]] = open_existential_ref [[IMMEDIATE]]
// CHECK: [[METHOD:%.*]] = function_ref
// CHECK: apply [[METHOD]]<{{.*}}>([[VALUE]])
// CHECK-NOT: strong_release [[VALUE]]
// CHECK: strong_release [[VALUE]]
// CHECK-NOT: strong_release [[IMMEDIATE]]
// GUARANTEED: [[IMMEDIATE:%.*]] = load [[IMMEDIATE_BOX]]
@@ -303,7 +290,7 @@ func test_open_existential_semantics_class(guaranteed: CP1,
// CHECK: [[VALUE:%.*]] = open_existential_ref [[PLUS_ONE]]
// CHECK: [[METHOD:%.*]] = function_ref
// CHECK: apply [[METHOD]]<{{.*}}>([[VALUE]])
// CHECK-NOT: strong_release [[VALUE]]
// CHECK: strong_release [[VALUE]]
// CHECK-NOT: strong_release [[PLUS_ONE]]
// GUARANTEED: [[F:%.*]] = function_ref {{.*}}plusOneCP1

View File

@@ -249,11 +249,14 @@ class ClassWithGetter : PropertyWithGetter {
// Make sure we are generating a protocol witness that calls the class method on
// ClassWithGetter.
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWC9protocols15ClassWithGetterS_18PropertyWithGetterS_FS1_g1aSi : $@cc(witness_method) @thin (@in_guaranteed ClassWithGetter) -> Int {
// CHECK: bb0
// CHECK-NEXT: load
// CHECK-NEXT: strong_retain
// CHECK-NEXT: class_method
// CHECK-NEXT: apply
// CHECK: bb0([[C:%.*]] : $*ClassWithGetter):
// CHECK-NEXT: [[CCOPY:%.*]] = alloc_stack $ClassWithGetter
// CHECK-NEXT: copy_addr [[C]] to [initialization] [[CCOPY]]#1
// CHECK-NEXT: [[CCOPY_LOADED:%.*]] = load [[CCOPY]]#1
// CHECK-NEXT: [[FUN:%.*]] = class_method [[CCOPY_LOADED]] : $ClassWithGetter, #ClassWithGetter.a!getter.1 : ClassWithGetter -> () -> Int , $@cc(method) @thin (@guaranteed ClassWithGetter) -> Int
// CHECK-NEXT: apply [[FUN]]([[CCOPY_LOADED]])
// CHECK-NEXT: strong_release [[CCOPY_LOADED]]
// CHECK-NEXT: dealloc_stack [[CCOPY]]#0
// CHECK-NEXT: return
class ClassWithGetterSetter : PropertyWithGetterSetter, PropertyWithGetter {
@@ -272,11 +275,14 @@ class ClassWithGetterSetter : PropertyWithGetterSetter, PropertyWithGetter {
}
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWC9protocols21ClassWithGetterSetterS_24PropertyWithGetterSetterS_FS1_g1bSi : $@cc(witness_method) @thin (@in_guaranteed ClassWithGetterSetter) -> Int {
// CHECK: bb0
// CHECK-NEXT: load
// CHECK-NEXT: strong_retain
// CHECK-NEXT: class_method
// CHECK-NEXT: apply
// CHECK: bb0([[C:%.*]] : $*ClassWithGetterSetter):
// CHECK-NEXT: [[CCOPY:%.*]] = alloc_stack $ClassWithGetterSetter
// CHECK-NEXT: copy_addr [[C]] to [initialization] [[CCOPY]]#1
// CHECK-NEXT: [[CCOPY_LOADED:%.*]] = load [[CCOPY]]#1
// CHECK-NEXT: [[FUN:%.*]] = class_method [[CCOPY_LOADED]] : $ClassWithGetterSetter, #ClassWithGetterSetter.b!getter.1 : ClassWithGetterSetter -> () -> Int , $@cc(method) @thin (@guaranteed ClassWithGetterSetter) -> Int
// CHECK-NEXT: apply [[FUN]]([[CCOPY_LOADED]])
// CHECK-NEXT: strong_release [[CCOPY_LOADED]]
// CHECK-NEXT: dealloc_stack [[CCOPY]]#0
// CHECK-NEXT: return
// Stored variables fulfilling property requirements
@@ -289,13 +295,13 @@ class ClassWithStoredProperty : PropertyWithGetter {
return a
}
// CHECK-LABEL: sil hidden @{{.*}}ClassWithStoredProperty{{.*}}methodUsingProperty
// CHECK-NEXT: bb0(%0 : $ClassWithStoredProperty):
// CHECK-NEXT: debug_value %0
// CHECK-NEXT: strong_retain %0 : $ClassWithStoredProperty
// CHECK-NEXT: %3 = class_method %0 : $ClassWithStoredProperty, #ClassWithStoredProperty.a!getter.1
// CHECK-NEXT: %4 = apply %3(%0)
// CHECK-NEXT: strong_release %0 : $ClassWithStoredProperty
// CHECK-NEXT: return %4 : $Int
// CHECK-NEXT: bb0([[ARG:%.*]] : $ClassWithStoredProperty):
// CHECK-NEXT: debug_value [[ARG]]
// CHECK-NOT: strong_retain
// CHECK-NEXT: [[FUN:%.*]] = class_method [[ARG]] : $ClassWithStoredProperty, #ClassWithStoredProperty.a!getter.1 : ClassWithStoredProperty -> () -> Int , $@cc(method) @thin (@guaranteed ClassWithStoredProperty) -> Int
// CHECK-NEXT: [[RESULT:%.*]] = apply [[FUN]]([[ARG]])
// CHECK-NOT: strong_release
// CHECK-NEXT: return [[RESULT]] : $Int
}
struct StructWithStoredProperty : PropertyWithGetter {
@@ -314,14 +320,57 @@ struct StructWithStoredProperty : PropertyWithGetter {
// Make sure that we generate direct function calls for out struct protocl
// witness since structs don't do virtual calls for methods.
//
// *NOTE* Even though at first glance the copy_addr looks like a leak
// here, StructWithStoredProperty is a trivial struct implying that no
// leak is occuring. See the test with StructWithStoredClassProperty
// that makes sure in such a case we don't leak. This is due to the
// thunking code being too dumb but it is harmless to program
// correctness.
//
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWV9protocols24StructWithStoredPropertyS_18PropertyWithGetterS_FS1_g1aSi : $@cc(witness_method) @thin (@in_guaranteed StructWithStoredProperty) -> Int {
// CHECK: bb0
// CHECK-NEXT: load
// CHECK: bb0([[C:%.*]] : $*StructWithStoredProperty):
// CHECK-NEXT: [[CCOPY:%.*]] = alloc_stack $StructWithStoredProperty
// CHECK-NEXT: copy_addr [[C]] to [initialization] [[CCOPY]]#1
// CHECK-NEXT: [[CCOPY_LOADED:%.*]] = load [[CCOPY]]#1
// CHECK-NEXT: function_ref
// CHECK-NEXT: function_ref @_TFV9protocols24StructWithStoredPropertyg1aSi : $@cc(method) @thin (StructWithStoredProperty) -> Int
// CHECK-NEXT: apply %2(%1) : $@cc(method) @thin (StructWithStoredProperty) -> Int
// CHECK-NEXT: [[FUN:%.*]] = function_ref @_TFV9protocols24StructWithStoredPropertyg1aSi : $@cc(method) @thin (StructWithStoredProperty) -> Int
// CHECK-NEXT: apply [[FUN]]([[CCOPY_LOADED]])
// CHECK-NEXT: dealloc_stack [[CCOPY]]#0
// CHECK-NEXT: return
class C {}
// Make sure that if the getter has a class property, we pass it in
// in_guaranteed and don't leak.
struct StructWithStoredClassProperty : PropertyWithGetter {
var a : Int
var c: C = C()
// Make sure that accesses aren't going through the generated accessors.
func methodUsingProperty() -> Int {
return a
}
// CHECK-LABEL: sil hidden @{{.*}}StructWithStoredClassProperty{{.*}}methodUsingProperty
// CHECK-NEXT: bb0(%0 : $StructWithStoredClassProperty):
// CHECK-NEXT: debug_value %0
// CHECK-NEXT: %2 = struct_extract %0 : $StructWithStoredClassProperty, #StructWithStoredClassProperty.a
// CHECK-NEXT: return %2 : $Int
}
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWV9protocols29StructWithStoredClassPropertyS_18PropertyWithGetterS_FS1_g1aSi : $@cc(witness_method) @thin (@in_guaranteed StructWithStoredClassProperty) -> Int {
// CHECK: bb0([[C:%.*]] : $*StructWithStoredClassProperty):
// CHECK-NEXT: [[CCOPY:%.*]] = alloc_stack $StructWithStoredClassProperty
// CHECK-NEXT: copy_addr [[C]] to [initialization] [[CCOPY]]#1
// CHECK-NEXT: [[CCOPY_LOADED:%.*]] = load [[CCOPY]]#1
// CHECK-NEXT: function_ref
// CHECK-NEXT: [[FUN:%.*]] = function_ref @_TFV9protocols29StructWithStoredClassPropertyg1aSi : $@cc(method) @thin (@guaranteed StructWithStoredClassProperty) -> Int
// CHECK-NEXT: apply [[FUN]]([[CCOPY_LOADED]])
// CHECK-NEXT: release_value [[CCOPY_LOADED]]
// CHECK-NEXT: dealloc_stack [[CCOPY]]#0
// CHECK-NEXT: return
// CHECK-LABEL: sil_witness_table hidden ClassWithGetter: PropertyWithGetter module protocols {
// CHECK-NEXT: method #PropertyWithGetter.a!getter.1: @_TTWC9protocols15ClassWithGetterS_18PropertyWithGetterS_FS1_g1aSi
// CHECK-NEXT: }
@@ -336,4 +385,10 @@ struct StructWithStoredProperty : PropertyWithGetter {
// CHECK-NEXT: method #PropertyWithGetter.a!getter.1: @_TTWC9protocols21ClassWithGetterSetterS_18PropertyWithGetterS_FS1_g1aSi
// CHECK-NEXT: }
// CHECK-LABEL: sil_witness_table hidden StructWithStoredProperty: PropertyWithGetter module protocols {
// CHECK-NEXT: method #PropertyWithGetter.a!getter.1: @_TTWV9protocols24StructWithStoredPropertyS_18PropertyWithGetterS_FS1_g1aSi
// CHECK-NEXT: }
// CHECK-LABEL: sil_witness_table hidden StructWithStoredClassProperty: PropertyWithGetter module protocols {
// CHECK-NEXT: method #PropertyWithGetter.a!getter.1: @_TTWV9protocols29StructWithStoredClassPropertyS_18PropertyWithGetterS_FS1_g1aSi
// CHECK-NEXT: }

View File

@@ -4,15 +4,15 @@ class C {
var member: Int = 0
// Methods have method calling convention.
// CHECK-LABEL: sil hidden @{{.*}}C3foo{{.*}} : $@cc(method) @thin (Int, @owned C) -> ()
// CHECK-LABEL: sil hidden @_TFC5types1C3foofS0_FT1xSi_T_ : $@cc(method) @thin (Int, @guaranteed C) -> () {
func foo(#x: Int) {
// CHECK: bb0([[X:%[0-9]+]] : $Int, [[THIS:%[0-9]+]] : $C):
member = x
// CHECK: strong_retain %1 : $C
// CHECK-NOT: strong_retain
// CHECK: [[FN:%[0-9]+]] = class_method %1 : $C, #C.member!setter.1
// CHECK: apply [[FN]](%0, %1) : $@cc(method) @thin (Int, @owned C) -> ()
// CHECK: strong_release %1 : $C
// CHECK: apply [[FN]](%0, %1) : $@cc(method) @thin (Int, @guaranteed C) -> ()
// CHECK-NOT: strong_release
}

View File

@@ -92,13 +92,14 @@ func test_unowned_let_capture(aC : C) {
}
// CHECK-LABEL: sil shared @_TFF7unowned24test_unowned_let_captureFCS_1CT_U_FT_Si : $@thin (@owned @sil_unowned C) -> Int {
// CHECK-NEXT: bb0(%0 : $@sil_unowned C):
// CHECK-NEXT: strong_retain_unowned %0 : $@sil_unowned C
// CHECK-NEXT: %2 = unowned_to_ref %0 : $@sil_unowned C to $C
// CHECK-NEXT: %3 = class_method %2 : $C, #C.f!1 : C -> () -> Int , $@cc(method) @thin (@owned C) -> Int
// CHECK-NEXT: %4 = apply %3(%2) : $@cc(method) @thin (@owned C) -> Int
// CHECK-NEXT: unowned_release %0 : $@sil_unowned C
// CHECK-NEXT: return %4 : $Int
// CHECK-NEXT: bb0([[ARG:%.*]] : $@sil_unowned C):
// CHECK-NEXT: strong_retain_unowned [[ARG]] : $@sil_unowned C
// CHECK-NEXT: [[UNOWNED_ARG:%.*]] = unowned_to_ref [[ARG]] : $@sil_unowned C to $C
// CHECK-NEXT: [[FUN:%.*]] = class_method [[UNOWNED_ARG]] : $C, #C.f!1 : C -> () -> Int , $@cc(method) @thin (@guaranteed C) -> Int
// CHECK-NEXT: [[RESULT:%.*]] = apply [[FUN]]([[UNOWNED_ARG]]) : $@cc(method) @thin (@guaranteed C) -> Int
// CHECK-NEXT: strong_release [[UNOWNED_ARG]]
// CHECK-NEXT: unowned_release [[ARG]] : $@sil_unowned C
// CHECK-NEXT: return [[RESULT]] : $Int

View File

@@ -270,9 +270,9 @@ func <~>(x: ConformingClassToClassProtocol,
// TABLE-NEXT: method #ClassProtocol.staticMethod!1: @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_ZFS1_12staticMethodUS1__U_S_9AssocReqt__fMQPS1_FT1xS3__T_
// TABLE-NEXT: method #ClassProtocol."<~>"!1: @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_ZFS1_oi3ltgUS1__U_S_9AssocReqt__fMQPS1
// TABLE-NEXT: }
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_FS1_6methodUS1__U_S_9AssocReqt__fQPS1_FT1xVS_3Arg1yS3__T_ : $@cc(witness_method) @thin (Arg, @owned ConformingClassToClassProtocol, @owned ConformingClassToClassProtocol) -> ()
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_FS1_7genericUS1__U_S_9AssocReqt__fQPS1_US_13ArchetypeReqt__FT1xQ_1yS3__T_ : $@cc(witness_method) @thin <B where B : ArchetypeReqt> (@in B, @owned ConformingClassToClassProtocol, @owned ConformingClassToClassProtocol) -> ()
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_FS1_16assocTypesMethodUS1__U_S_9AssocReqt__fQPS1_FT1xQS3_9AssocType1yQS3_13AssocWithReqt_T_ : $@cc(witness_method) @thin (@in SomeAssoc, @in ConformingAssoc, @owned ConformingClassToClassProtocol) -> ()
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_FS1_6methodUS1__U_S_9AssocReqt__fQPS1_FT1xVS_3Arg1yS3__T_ : $@cc(witness_method) @thin (Arg, @owned ConformingClassToClassProtocol, @guaranteed ConformingClassToClassProtocol) -> ()
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_FS1_7genericUS1__U_S_9AssocReqt__fQPS1_US_13ArchetypeReqt__FT1xQ_1yS3__T_ : $@cc(witness_method) @thin <B where B : ArchetypeReqt> (@in B, @owned ConformingClassToClassProtocol, @guaranteed ConformingClassToClassProtocol) -> ()
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_FS1_16assocTypesMethodUS1__U_S_9AssocReqt__fQPS1_FT1xQS3_9AssocType1yQS3_13AssocWithReqt_T_ : $@cc(witness_method) @thin (@in SomeAssoc, @in ConformingAssoc, @guaranteed ConformingClassToClassProtocol) -> ()
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_ZFS1_12staticMethodUS1__U_S_9AssocReqt__fMQPS1_FT1xS3__T_ : $@cc(witness_method) @thin (@owned ConformingClassToClassProtocol, @thick ConformingClassToClassProtocol.Type) -> ()
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables30ConformingClassToClassProtocolS_13ClassProtocolS_ZFS1_oi3ltgUS1__U_S_9AssocReqt__fMQPS1{{.*}} : $@cc(witness_method) @thin (@owned ConformingClassToClassProtocol, @owned ConformingClassToClassProtocol, @thick ConformingClassToClassProtocol.Type) -> ()
@@ -468,7 +468,7 @@ func <~>(x: ClassInheritedConformance, y: ClassInheritedConformance) {}
// InheritedClassProtocol has a class bound, so its witnesses treat Self as
// a reference value.
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables25ClassInheritedConformanceS_11AnyProtocolS_FS1_6methodUS1__U_S_9AssocReqt__fQPS1_FT1xVS_3Arg1yS3__T_ : $@cc(witness_method) @thin (Arg, @in ClassInheritedConformance, @in_guaranteed ClassInheritedConformance) -> ()
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables25ClassInheritedConformanceS_22InheritedClassProtocolS_FS1_15inheritedMethodUS1__U_S_9AssocReqt__fQPS1_FT_T_ : $@cc(witness_method) @thin (@owned ClassInheritedConformance) -> ()
// SYMBOL: sil hidden [transparent] [thunk] @_TTWC14witness_tables25ClassInheritedConformanceS_22InheritedClassProtocolS_FS1_15inheritedMethodUS1__U_S_9AssocReqt__fQPS1_FT_T_ : $@cc(witness_method) @thin (@guaranteed ClassInheritedConformance) -> ()
struct GenericAssocType<T> : AssocReqt {
func requiredMethod() {}

View File

@@ -167,9 +167,10 @@ final class ConformingClass : X {
// CHECK-NEXT: strong_retain %3 : $ConformingClass
// CHECK-NEXT: %5 = load %1 : $*ConformingClass
// CHECK: %6 = function_ref @_TFC9witnesses15ConformingClass9selfTypesfS0_FT1xS0__S0_
// CHECK-NEXT: %7 = apply %6(%5, %3) : $@cc(method) @thin (@owned ConformingClass, @owned ConformingClass) -> @owned ConformingClass
// CHECK-NEXT: %7 = apply %6(%5, %3) : $@cc(method) @thin (@owned ConformingClass, @guaranteed ConformingClass) -> @owned ConformingClass
// CHECK-NEXT: store %7 to %0 : $*ConformingClass
// CHECK-NEXT: %9 = tuple ()
// CHECK-NEXT: strong_release %3
// CHECK-NEXT: return %9 : $()
// CHECK-NEXT: }
func loadable(#x: Loadable) -> Loadable { return x }
@@ -180,11 +181,14 @@ final class ConformingClass : X {
func <~>(x: ConformingClass, y: ConformingClass) -> ConformingClass { return x }
extension ConformingClass : ClassBounded { }
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWC9witnesses15ConformingClassS_12ClassBoundedS_FS1_9selfTypesUS1___fQPS1_FT1xS2__S2_ : $@cc(witness_method) @thin (@owned ConformingClass, @owned ConformingClass) -> @owned ConformingClass {
// CHECK-NEXT: bb0(%0 : $ConformingClass, %1 : $ConformingClass):
// CHECK: %2 = function_ref @_TFC9witnesses15ConformingClass9selfTypesfS0_FT1xS0__S0_
// CHECK-NEXT: %3 = apply %2(%0, %1) : $@cc(method) @thin (@owned ConformingClass, @owned ConformingClass) -> @owned ConformingClass
// CHECK-NEXT: return %3 : $ConformingClass
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWC9witnesses15ConformingClassS_12ClassBoundedS_FS1_9selfTypesUS1___fQPS1_FT1xS2__S2_ : $@cc(witness_method) @thin (@owned ConformingClass, @guaranteed ConformingClass) -> @owned ConformingClass {
// CHECK: bb0([[C0:%.*]] : $ConformingClass, [[C1:%.*]] : $ConformingClass):
// CHECK-NEXT: strong_retain [[C1]]
// CHECK-NEXT: function_ref
// CHECK-NEXT: [[FUN:%.*]] = function_ref @_TFC9witnesses15ConformingClass9selfTypesfS0_FT1xS0__S0_
// CHECK-NEXT: [[RESULT:%.*]] = apply [[FUN]]([[C0]], [[C1]]) : $@cc(method) @thin (@owned ConformingClass, @guaranteed ConformingClass) -> @owned ConformingClass
// CHECK-NEXT: strong_release [[C1]]
// CHECK-NEXT: return [[RESULT]] : $ConformingClass
// CHECK-NEXT: }
struct ConformingAOStruct : X {

View File

@@ -25,9 +25,12 @@ class Foo: Fooable {
}
// CHECK-LABEL: sil hidden @_TF15witnesses_class3genUS_7Fooable__FQ_T_
// CHECK: bb0([[SELF:%.*]] : $T)
// CHECK: [[METHOD:%.*]] = witness_method $T
// CHECK: strong_retain [[SELF:%.*]] : $
// CHECK-NOT: strong_retain [[SELF]]
// CHECK: apply [[METHOD]]<T>([[SELF]])
// CHECK: strong_release [[SELF]]
// CHECK-NOT: strong_release [[SELF]]
// CHECK: return
func gen<T: Fooable>(foo: T) {
foo.foo()
@@ -37,8 +40,10 @@ func gen<T: Fooable>(foo: T) {
// CHECK: bb0([[SELF:%[0-0]+]] : $Fooable):
// CHECK: [[SELF_PROJ:%.*]] = open_existential_ref [[SELF]]
// CHECK: [[METHOD:%.*]] = witness_method $[[OPENED:@opened(.*) Fooable]],
// CHECK: strong_retain [[SELF_PROJ]] : $
// CHECK-NOT: strong_retain [[SELF_PROJ]] : $
// CHECK: apply [[METHOD]]<[[OPENED]]>([[SELF_PROJ]])
// CHECK: strong_release [[SELF]]
// CHECK-NOT: strong_release [[SELF]]
// CHECK: return
func ex(foo: Fooable) {
foo.foo()

View File

@@ -35,6 +35,8 @@ class B : A, Barrable {}
// CHECK-NOT: sil hidden [transparent] [thunk] @_TTWC21witnesses_inheritance1BS_7FooableS_FS1_3fooUS1___fQPS1_FT_T_
// CHECK-NOT: sil hidden [transparent] [thunk] @_TTWC21witnesses_inheritance1BS_7FooableS_ZFS1_9class_fooUS1___fMQPS1_FT_T_
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWC21witnesses_inheritance1BS_8BarrableS_FS1_3barUS1___fQPS1_FT_T_
// CHECK: upcast {{%.*}} : $B to $A
// CHECK: upcast {{%.*}} : $*B to $*A
// CHECK-LABEL: sil hidden [transparent] [thunk] @_TTWC21witnesses_inheritance1BS_8BarrableS_ZFS1_9class_barUS1___fMQPS1_FT_T_
// CHECK: upcast {{%.*}} : $@thick B.Type to $@thick A.Type
// Add tests to make sure that we handle address only case correctly.

View File

@@ -7,11 +7,11 @@ public func test() {
}
// CHECK-LABEL: sil shared @_TFFC38devirt_single_module_in_multiple_files9EvaluatorcFMS0_FT_S0_U_FT_Si
// CHECK: %{{.*}} = class_method %{{.*}} : $Problem1, #Problem1.run!1 : Problem1 -> () -> Int , $@cc(method) @thin (@owned Problem1) -> Int
// CHECK: %{{.*}} = class_method %{{.*}} : $Problem1, #Problem1.run!1 : Problem1 -> () -> Int , $@cc(method) @thin (@guaranteed Problem1) -> Int
// CHECK-NEXT: apply
// CHECK: return
// CHECK-LABEL: sil shared @_TFFC38devirt_single_module_in_multiple_files9EvaluatorcFMS0_FT_S0_U0_FT_Si
// CHECK: %{{.*}} = class_method %{{.*}} : $Problem2, #Problem2.run!1 : Problem2 -> () -> Int , $@cc(method) @thin (@owned Problem2) -> Int
// CHECK: %{{.*}} = class_method %{{.*}} : $Problem2, #Problem2.run!1 : Problem2 -> () -> Int , $@cc(method) @thin (@guaranteed Problem2) -> Int
// CHECK-NEXT: apply
// CHECK: return

View File

@@ -52,7 +52,9 @@
// CHECK-NEXT: class_method
// CHECK-NEXT: strong_retain
// CHECK-NEXT: apply
// CHECK-NEXT: strong_release
// CHECK-NEXT: class_method
// CHECK-NEXT: strong_retain
// CHECK-NEXT: apply
// CHECK-NEXT: strong_release
// CHECK-NEXT: strong_release
@@ -60,6 +62,8 @@
// CHECK-NEXT: strong_release
// CHECK-NEXT: strong_release
// CHECK-NEXT: strong_release
// CHECK-NEXT: strong_release
// CHECK-NEXT: strong_release
// CHECK-NEXT: tuple
// CHECK-NEXT: return

View File

@@ -29,7 +29,7 @@ bb0(%c : $Builtin.Int32, %v : $Builtin.RawPointer):
return %6 : $Builtin.Int32
}
sil @REC_recursive : $@cc(method) @thin (Int, @owned REC) -> () {
sil @REC_recursive : $@cc(method) @thin (Int, @guaranteed REC) -> () {
bb0(%0 : $Int, %1 : $REC):
debug_value %0 : $Int // let a // id: %2
debug_value %1 : $REC // let self // id: %3
@@ -48,7 +48,7 @@ bb0(%0 : $Int, %1 : $REC):
bb1: // Preds: bb0
strong_retain %1 : $REC // id: %13
%14 = class_method %1 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @owned REC) -> () // user: %21
%14 = class_method %1 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @guaranteed REC) -> () // user: %21
// function_ref Swift.- @infix (Swift.Int, Swift.Int) -> Swift.Int
%15 = function_ref @_TFSsoi1sFTSiSi_Si : $@thin (Int, Int) -> Int // user: %20
// function_ref Swift.Int._convertFromBuiltinIntegerLiteral (Swift.Int.Type)(Builtin.Int2048) -> Swift.Int
@@ -57,9 +57,9 @@ bb1: // Preds: bb0
%18 = integer_literal $Builtin.Int2048, 2 // user: %19
%19 = apply %16(%18, %17) : $@thin (Builtin.Int2048, @thin Int.Type) -> Int // user: %20
%20 = apply %15(%0, %19) : $@thin (Int, Int) -> Int // user: %21
%21 = apply %14(%20, %1) : $@cc(method) @thin (Int, @owned REC) -> ()
%21 = apply %14(%20, %1) : $@cc(method) @thin (Int, @guaranteed REC) -> ()
strong_retain %1 : $REC // id: %22
%23 = class_method %1 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @owned REC) -> () // user: %30
%23 = class_method %1 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @guaranteed REC) -> () // user: %30
// function_ref Swift.- @infix (Swift.Int, Swift.Int) -> Swift.Int
%24 = function_ref @_TFSsoi1sFTSiSi_Si : $@thin (Int, Int) -> Int // user: %29
// function_ref Swift.Int._convertFromBuiltinIntegerLiteral (Swift.Int.Type)(Builtin.Int2048) -> Swift.Int
@@ -68,7 +68,7 @@ bb1: // Preds: bb0
%27 = integer_literal $Builtin.Int2048, 1 // user: %28
%28 = apply %25(%27, %26) : $@thin (Builtin.Int2048, @thin Int.Type) -> Int // user: %29
%29 = apply %24(%0, %28) : $@thin (Int, Int) -> Int // user: %30
%30 = apply %23(%29, %1) : $@cc(method) @thin (Int, @owned REC) -> ()
%30 = apply %23(%29, %1) : $@cc(method) @thin (Int, @guaranteed REC) -> ()
br bb2 // id: %31
bb2: // Preds: bb0 bb1
@@ -138,8 +138,8 @@ bb0(%0 : $Int):
%4 = apply %2(%3) : $@thin (@thick REC.Type) -> @owned REC // users: %5, %6, %7, %8, %9
debug_value %4 : $REC // let rec // id: %5
strong_retain %4 : $REC // id: %6
%7 = class_method %4 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @owned REC) -> () // user: %8
%8 = apply %7(%0, %4) : $@cc(method) @thin (Int, @owned REC) -> ()
%7 = class_method %4 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @guaranteed REC) -> () // user: %8
%8 = apply %7(%0, %4) : $@cc(method) @thin (Int, @guaranteed REC) -> ()
strong_release %4 : $REC // id: %9
%10 = tuple () // user: %11
return %10 : $() // id: %11

View File

@@ -31,7 +31,7 @@ bb0(%c : $Builtin.Int32, %v : $Builtin.RawPointer):
}
// single.REC.recursive (single.REC)(Swift.Int) -> ()
sil @_TFC6single3REC9recursivefS0_FSiT_ : $@cc(method) @thin (Int, @owned REC) -> () {
sil @_TFC6single3REC9recursivefS0_FSiT_ : $@cc(method) @thin (Int, @guaranteed REC) -> () {
bb0(%0 : $Int, %1 : $REC):
debug_value %0 : $Int // let a // id: %2
debug_value %1 : $REC // let self // id: %3
@@ -50,7 +50,7 @@ bb0(%0 : $Int, %1 : $REC):
bb1: // Preds: bb0
strong_retain %1 : $REC // id: %13
%14 = class_method %1 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @owned REC) -> () // user: %21
%14 = class_method %1 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @guaranteed REC) -> () // user: %21
// function_ref Swift.- @infix (Swift.Int, Swift.Int) -> Swift.Int
%15 = function_ref @_TFSsoi1sFTSiSi_Si : $@thin (Int, Int) -> Int // user: %20
// function_ref Swift.Int._convertFromBuiltinIntegerLiteral (Swift.Int.Type)(Builtin.Int2048) -> Swift.Int
@@ -59,7 +59,7 @@ bb1: // Preds: bb0
%18 = integer_literal $Builtin.Int2048, 2 // user: %19
%19 = apply %16(%18, %17) : $@thin (Builtin.Int2048, @thin Int.Type) -> Int // user: %20
%20 = apply %15(%0, %19) : $@thin (Int, Int) -> Int // user: %21
%21 = apply %14(%20, %1) : $@cc(method) @thin (Int, @owned REC) -> ()
%21 = apply %14(%20, %1) : $@cc(method) @thin (Int, @guaranteed REC) -> ()
br bb2 // id: %22
bb2: // Preds: bb0 bb1
@@ -129,8 +129,8 @@ bb0(%0 : $Int):
%4 = apply %2(%3) : $@thin (@thick REC.Type) -> @owned REC // users: %5, %6, %7, %8, %9
debug_value %4 : $REC // let rec // id: %5
strong_retain %4 : $REC // id: %6
%7 = class_method %4 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @owned REC) -> () // user: %8
%8 = apply %7(%0, %4) : $@cc(method) @thin (Int, @owned REC) -> ()
%7 = class_method %4 : $REC, #REC.recursive!1 : REC -> (Int) -> () , $@cc(method) @thin (Int, @guaranteed REC) -> () // user: %8
%8 = apply %7(%0, %4) : $@cc(method) @thin (Int, @guaranteed REC) -> ()
strong_release %4 : $REC // id: %9
%10 = tuple () // user: %11
return %10 : $() // id: %11

View File

@@ -201,7 +201,7 @@ bb0:
%O = unchecked_ref_cast %C : $C to $Builtin.UnknownObject
// CHECK: class_method {{.*}} : $C, #C.doIt!1
%2 = class_method %C : $C, #C.doIt!1 : C -> () -> (), $@cc(method) @thin (@owned C) -> ()
%2 = class_method %C : $C, #C.doIt!1 : C -> () -> (), $@cc(method) @thin (@guaranteed C) -> ()
// CHECK: alloc_ref $D
%D = alloc_ref $D
@@ -415,8 +415,8 @@ class M {
init()
}
// CHECK-LABEL: @_TFC3ref1C3foofS0_FT1xSi_T_ : $@cc(method) @thin (Int, M) -> ()
sil [fragile] @_TFC3ref1C3foofS0_FT1xSi_T_ : $@cc(method) @thin (Int, M) -> () {
// CHECK-LABEL: @_TFC3ref1C3foofS0_FT1xSi_T_ : $@cc(method) @thin (Int, @guaranteed M) -> ()
sil [fragile] @_TFC3ref1C3foofS0_FT1xSi_T_ : $@cc(method) @thin (Int, @guaranteed M) -> () {
bb0(%0 : $Int, %1 : $M):
%2 = alloc_box $Int
%3 = store %0 to %2#1 : $*Int
@@ -605,7 +605,7 @@ class Bas : NSObject {
override init()
}
sil [fragile] @test_autorelease_return : $@cc(objc_method) @thin (Bas) -> NSString
sil [fragile] @test_super_method : $@cc(method) @thin (Bas) -> Bas
sil [fragile] @test_super_method : $@cc(method) @thin (@guaranteed Bas) -> Bas
sil [fragile] @swift_StringToNSString : $@thin (@inout String) -> @owned NSString
sil [fragile] @_TFSSCfMSSFT_SS : $@thin (@thin String.Type) -> String
@@ -1095,9 +1095,9 @@ class Foo {
init()
}
// CHECK-LABEL: sil [fragile] @_TFC3tmp3Foog9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int, Int, @owned Foo) -> Int32
// CHECK_DECL-LABEL: sil [fragile] @_TFC3tmp3Foog9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int, Int, @owned Foo) -> Int32{{$}}
sil [fragile] @_TFC3tmp3Foog9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int, Int, @owned Foo) -> Int32 {
// CHECK-LABEL: sil [fragile] @_TFC3tmp3Foog9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int, Int, @guaranteed Foo) -> Int32
// CHECK_DECL-LABEL: sil [fragile] @_TFC3tmp3Foog9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int, Int, @guaranteed Foo) -> Int32{{$}}
sil [fragile] @_TFC3tmp3Foog9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int, Int, @guaranteed Foo) -> Int32 {
bb0(%0 : $Int, %1 : $Int, %2 : $Foo):
%3 = tuple ()
%4 = alloc_stack $Int // var x // users: %17, %6
@@ -1116,9 +1116,9 @@ bb0(%0 : $Int, %1 : $Int, %2 : $Foo):
return %13 : $Int32
}
// CHECK-LABEL: sil [fragile] @_TFC3tmp3Foos9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int32, Int, Int, @owned Foo) -> ()
// CHECK_DECL-LABEL: sil [fragile] @_TFC3tmp3Foos9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int32, Int, Int, @owned Foo) -> (){{$}}
sil [fragile] @_TFC3tmp3Foos9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int32, Int, Int, @owned Foo) -> () {
// CHECK-LABEL: sil [fragile] @_TFC3tmp3Foos9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int32, Int, Int, @guaranteed Foo) -> ()
// CHECK_DECL-LABEL: sil [fragile] @_TFC3tmp3Foos9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int32, Int, Int, @guaranteed Foo) -> (){{$}}
sil [fragile] @_TFC3tmp3Foos9subscriptFT1xSi1ySi_Si : $@cc(method) @thin (Int32, Int, Int, @guaranteed Foo) -> () {
bb0(%0 : $Int32, %1 : $Int, %2 : $Int, %3 : $Foo):
%4 = alloc_stack $Int32 // var value // users: %16, %5
store %0 to %4#1 : $*Int32
@@ -1158,7 +1158,7 @@ struct ConformingAssoc : AssocReqt {
func requiredMethod()
}
sil [fragile] @_TFV14witness_tables15ConformingAssoc14requiredMethodfS0_FT_T_ : $@cc(method) @thin (ConformingAssoc) -> () {
sil [fragile] @_TFV14witness_tables15ConformingAssoc14requiredMethodfS0_FT_T_ : $@cc(method) @thin (@guaranteed ConformingAssoc) -> () {
bb0(%0 : $ConformingAssoc):
debug_value %0 : $ConformingAssoc
%2 = tuple ()
@@ -1168,8 +1168,8 @@ bb0(%0 : $ConformingAssoc):
sil [fragile] @_TTWV14witness_tables15ConformingAssocS_9AssocReqtS_FS1_14requiredMethodU_fRQPS1_FT_T_ : $@cc(witness_method) @thin (@inout ConformingAssoc) -> () {
bb0(%0 : $*ConformingAssoc):
%1 = load %0 : $*ConformingAssoc
%2 = function_ref @_TFV14witness_tables15ConformingAssoc14requiredMethodfS0_FT_T_ : $@cc(method) @thin (ConformingAssoc) -> ()
%3 = apply %2(%1) : $@cc(method) @thin (ConformingAssoc) -> ()
%2 = function_ref @_TFV14witness_tables15ConformingAssoc14requiredMethodfS0_FT_T_ : $@cc(method) @thin (@guaranteed ConformingAssoc) -> ()
%3 = apply %2(%1) : $@cc(method) @thin (@guaranteed ConformingAssoc) -> ()
return %3 : $()
}
@@ -1239,7 +1239,7 @@ bb0:
%43 = function_ref @_TF5tuple5floatFT1xSf_T_ : $@thin (Float32) -> ()
%45 = function_ref @_TF5tuple5tupleFT_TSiSf_ : $@thin () -> (Int, Float32)
%47 = function_ref @_TF5tuple13tuple_elementFT1xTSiSf__T_ : $@thin (Int, Float32) -> ()
%49 = function_ref @_TFC3ref1C3foofS0_FT1xSi_T_ : $@cc(method) @thin (Int, M) -> ()
%49 = function_ref @_TFC3ref1C3foofS0_FT1xSi_T_ : $@cc(method) @thin (Int, @guaranteed M) -> ()
%51 = function_ref @_TF4null3isaFT1bCS_1B_Sb : $@thin (B) -> Builtin.Int1
%53 = function_ref @_TFSd31_convertFromBuiltinFloatLiteralfMSdFT5valueBf64__Sd : $@thin (Builtin.FPIEEE64, @thin Float64.Type) -> Float64
%55 = function_ref @_TFSS32_convertFromBuiltinStringLiteralfMSSFT5valueBp8byteSizeBi64_7isASCIIBi1__SS : $@thin (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> String
@@ -1254,7 +1254,7 @@ bb0:
%75 = function_ref @test_cond_branch_basic_block_args : $@thin (Int, Builtin.Int1) -> Int
%77 = function_ref @test_autorelease_return : $@cc(objc_method) @thin (Bas) -> NSString
%79 = function_ref @test_super_method : $@cc(method) @thin (Bas) -> Bas
%79 = function_ref @test_super_method : $@cc(method) @thin (@guaranteed Bas) -> Bas
%81 = function_ref @test_builtin_func_ref : $@thin (Builtin.Int1, Builtin.Int1) -> Builtin.Int1
%83 = function_ref @test_dealloc_ref : $@thin () -> ()
%85 = function_ref @test_dealloc_box : $@thin () -> ()

View File

@@ -10,4 +10,4 @@ import generic_extension_1
["a", "b", "c"].wobble()
// CHECK: sil @_TFE19generic_extension_1Sa6wobbleU__fGSaQ__FT_GSqQ__ : $@cc(method) @thin <τ_0_0> (@out Optional<τ_0_0>, @owned Array<τ_0_0>) -> ()
// CHECK: sil @_TFE19generic_extension_1Sa6wobbleU__fGSaQ__FT_GSqQ__ : $@cc(method) @thin <τ_0_0> (@out Optional<τ_0_0>, @guaranteed Array<τ_0_0>) -> ()

View File

@@ -14,8 +14,8 @@
// EXTRACT-FOO-NOT: sil hidden @_TFV5basic1X4testfS0_FT_T_ : $@cc(method) @thin (X) -> () {
// EXTRACT-FOO-NOT: sil hidden @_TFC5basic7VehiclecfMS0_FT1nSi_S0_ : $@cc(method) @thin (Int, @owned Vehicle) -> @owned Vehicle {
// EXTRACT-FOO-NOT: sil hidden @_TFC5basic7Vehicle3nowfS0_FT_Si : $@cc(method) @thin (@owned Vehicle) -> Int {
// EXTRACT-FOO-NOT: sil hidden @_TFC5basic7VehiclecfMS0_FT1nSi_S0_ : $@cc(method) @thin (Int, @guaranteed Vehicle) -> @owned Vehicle {
// EXTRACT-FOO-NOT: sil hidden @_TFC5basic7Vehicle3nowfS0_FT_Si : $@cc(method) @thin (@guaranteed Vehicle) -> Int {
// EXTRACT-FOO-LABEL: sil hidden @_TF5basic3fooFT_Si : $@thin () -> Int {
// EXTRACT-FOO: bb0:
@@ -25,8 +25,8 @@
// EXTRACT-TEST-NOT: sil hidden @_TF5basic3fooFT_Si : $@thin () -> Int {
// EXTRACT-TEST-NOT: sil hidden @_TFC5basic7VehiclecfMS0_FT1nSi_S0_ : $@cc(method) @thin (Int, @owned Vehicle) -> @owned Vehicle {
// EXTRACT-TEST-NOT: sil hidden @_TFC5basic7Vehicle3nowfS0_FT_Si : $@cc(method) @thin (@owned Vehicle) -> Int {
// EXTRACT-TEST-NOT: sil hidden @_TFC5basic7VehiclecfMS0_FT1nSi_S0_ : $@cc(method) @thin (Int, @guaranteed Vehicle) -> @owned Vehicle {
// EXTRACT-TEST-NOT: sil hidden @_TFC5basic7Vehicle3nowfS0_FT_Si : $@cc(method) @thin (@guaranteed Vehicle) -> Int {
// EXTRACT-TEST-LABEL: sil hidden @_TFV5basic1X4testfS0_FT_T_ : $@cc(method) @thin (X) -> () {
// EXTRACT-TEST: bb0(%0 : $X):
@@ -53,16 +53,13 @@
// EXTRACT-NOW-NOT: sil hidden @_TF5basic3fooFT_Si : $@thin () -> Int {
// EXTRACT-NOW-NOT: sil hidden @_TFV5basic1X4testfS0_FT_T_ : $@cc(method) @thin (X) -> () {
// EXTRACT-NOW-NOT: sil hidden @_TFC5basic7VehiclecfMS0_FT1nSi_S0_ : $@cc(method) @thin (Int, @owned Vehicle) -> @owned Vehicle {
// EXTRACT-NOW-NOT: sil hidden @_TFC5basic7VehiclecfMS0_FT1nSi_S0_ : $@cc(method) @thin (Int, @guaranteed Vehicle) -> @owned Vehicle {
// EXTRACT-NOW-LABEL: sil hidden @_TFC5basic7Vehicle3nowfS0_FT_Si : $@cc(method) @thin (@owned Vehicle) -> Int {
// EXTRACT-NOW-LABEL: sil hidden @_TFC5basic7Vehicle3nowfS0_FT_Si : $@cc(method) @thin (@guaranteed Vehicle) -> Int {
// EXTRACT-NOW: bb0
// EXTRACT-NOW-NEXT: debug_value
// EXTRACT-NOW-NEXT: strong_retain
// EXTRACT-NOW-NEXT: ref_element_addr
// EXTRACT-NOW-NEXT: load
// EXTRACT-NOW-NEXT: strong_release
// EXTRACT-NOW-NEXT: strong_release
// EXTRACT-NOW-NEXT: return
struct X {

View File

@@ -12,8 +12,8 @@ for id in $(seq 0 $process_id_max); do
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=$process_count -ast-verifier-process-id=$id > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=$process_count -ast-verifier-process-id=$id > /dev/null
__EOF__
done

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=0 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=0 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=1 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=1 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=10 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=10 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=11 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=11 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=12 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=12 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=13 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=13 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=14 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=14 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=15 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=15 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=16 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=16 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=2 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=2 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=3 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=3 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=4 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=4 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=5 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=5 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=6 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=6 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=7 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=7 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=8 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=8 > /dev/null

View File

@@ -4,5 +4,5 @@
// Make sure that we can parse the stdlib.sil deserialized from Swift.swiftmodule.
// RUN: rm -f %t.*
// RUN: %target-sil-opt -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=9 > /dev/null
// RUN: %target-sil-opt -enable-guaranteed-self -sil-disable-ast-dump -verify %platform-module-dir/Swift.swiftmodule -module-name=Swift -o %t.sil
// RUN: %target-sil-opt -enable-guaranteed-self %t.sil -ast-verifier-process-count=17 -ast-verifier-process-id=9 > /dev/null