Skip to content

[lit] Change all %target-swift-frontend invocations to verify ownership. #23260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions test/IRGen/class_isa_pointers.sil
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ sil_vtable Purebred {}
// CHECK: [[ISA:%.*]] = load %swift.type*, %swift.type** [[ISA_PTR]]
// CHECK: [[VTABLE:%.*]] = bitcast %swift.type* [[ISA]]
// CHECK: getelementptr inbounds {{.*}} [[VTABLE]]
sil [ossa] @purebred_method : $@convention(thin) (@owned Purebred) -> () {
entry(%0 : @owned $Purebred):
sil @purebred_method : $@convention(thin) (@owned Purebred) -> () {
entry(%0 : $Purebred):
%m = class_method %0 : $Purebred, #Purebred.method!1 : (Purebred) -> () -> (), $@convention(method) (@guaranteed Purebred) -> ()
%z = apply %m(%0) : $@convention(method) (@guaranteed Purebred) -> ()
return %z : $()
Expand All @@ -46,24 +46,24 @@ sil_vtable Mongrel {}
// CHECK: [[ISA:%.*]] = inttoptr i64 [[T3]] to %swift.type*
// CHECK: [[VTABLE:%.*]] = bitcast %swift.type* [[ISA]]
// CHECK: getelementptr inbounds {{.*}} [[VTABLE]]
sil [ossa] @mongrel_method : $@convention(thin) (@owned Mongrel) -> () {
entry(%0 : @owned $Mongrel):
sil @mongrel_method : $@convention(thin) (@owned Mongrel) -> () {
entry(%0 : $Mongrel):
%m = class_method %0 : $Mongrel, #Mongrel.method!1 : (Mongrel) -> () -> (), $@convention(method) (@guaranteed Mongrel) -> ()
%z = apply %m(%0) : $@convention(method) (@guaranteed Mongrel) -> ()
return %z : $()
}

// ObjC stubs expected by ObjC metadata emission

sil private [ossa] @$s18class_isa_pointers7MongrelC6methodyyFTo : $@convention(objc_method) (Purebred) -> () {
entry(%0 : @unowned $Purebred):
sil private @$s18class_isa_pointers7MongrelC6methodyyFTo : $@convention(objc_method) (Purebred) -> () {
entry(%0 : $Purebred):
unreachable
}
sil private [ossa] @$s18class_isa_pointers7MongrelC7bellsOnACSgSi_tcfcTo : $@convention(objc_method) (Int, Purebred) -> () {
entry(%0 : $Int, %1 : @unowned $Purebred):
sil private @$s18class_isa_pointers7MongrelC7bellsOnACSgSi_tcfcTo : $@convention(objc_method) (Int, Purebred) -> () {
entry(%0 : $Int, %1 : $Purebred):
unreachable
}
sil private [ossa] @$s18class_isa_pointers7MongrelCACycfcTo : $@convention(objc_method) (Purebred) -> () {
entry(%0 : @unowned $Purebred):
sil private @$s18class_isa_pointers7MongrelCACycfcTo : $@convention(objc_method) (Purebred) -> () {
entry(%0 : $Purebred):
unreachable
}
10 changes: 5 additions & 5 deletions test/IRGen/exclusivity.sil
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ sil_vtable A {}
sil public_external @changeInt : $@convention(thin) (@inout Int) -> ()

// CHECK-LABEL: define {{.*}} @test1(
sil [ossa] @test1 : $@convention(thin) (@owned A) -> Int {
bb0(%0 : @owned $A):
sil @test1 : $@convention(thin) (@owned A) -> Int {
bb0(%0 : $A):
// CHECK: [[SCRATCH0:%.*]] = alloca [[BUFFER_T:\[.* x i8\]]],
// CHECK: [[SCRATCH1:%.*]] = alloca [[BUFFER_T:\[.* x i8\]]],

Expand All @@ -25,11 +25,11 @@ bb0(%0 : @owned $A):
// CHECK: call void @llvm.lifetime.start.p0i8(i64 -1, i8* [[T0]])
// CHECK: [[T0:%.*]] = bitcast [[INT:%TSi]]* [[PROP]] to i8*
// CHECK: call void @swift_beginAccess(i8* [[T0]], [[BUFFER_T]]* [[SCRATCH0]], [[SIZE_T:i32|i64]] 32, i8* null)
%4 = begin_access [read] [dynamic] %3 : $*Int
%4 = begin_access [read] [dynamic] %3 : $*Int

// CHECK: [[T0:%.*]] = getelementptr inbounds [[INT]], [[INT]]* %1, i32 0, i32 0
// CHECK: load {{.*}}* [[T0]]
%5 = load [trivial] %4 : $*Int
%5 = load %4 : $*Int

// CHECK: call void @swift_endAccess([[BUFFER_T]]* [[SCRATCH0]])
// CHECK: [[T0:%.*]] = bitcast [[BUFFER_T]]* [[SCRATCH0]] to i8*
Expand All @@ -54,6 +54,6 @@ bb0(%0 : @owned $A):
// CHECK: [[T0:%.*]] = bitcast [[BUFFER_T]]* [[SCRATCH1]] to i8*
// CHECK: call void @llvm.lifetime.end.p0i8(i64 -1, i8* [[T0]])
end_access %12 : $*Int
destroy_value %0 : $A
strong_release %0 : $A
return %5 : $Int
}
26 changes: 13 additions & 13 deletions test/IRGen/generic_classes.sil
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ entry:
// RootGeneric.x has fixed layout
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc i8 @RootGeneric_concrete_fragile_dependent_member_access_x
// CHECK: getelementptr inbounds [[ROOTGENERIC]], [[ROOTGENERIC]]* %0, i32 0, i32 1
sil [ossa] @RootGeneric_concrete_fragile_dependent_member_access_x : $<F> (RootGeneric<F>) -> UInt8 {
entry(%c : @unowned $RootGeneric<F>):
sil @RootGeneric_concrete_fragile_dependent_member_access_x : $<F> (RootGeneric<F>) -> UInt8 {
entry(%c : $RootGeneric<F>):
%p = ref_element_addr %c : $RootGeneric<F>, #RootGeneric.x
%x = load_borrow %p : $*UInt8
%x = load %p : $*UInt8
return %x : $UInt8
}

Expand All @@ -281,8 +281,8 @@ entry(%c : @unowned $RootGeneric<F>):
// CHECK: [[CLASS_BYTE_ARRAY:%.*]] = bitcast [[ROOTGENERIC]]* {{%.*}} to i8*
// CHECK: [[Y_ADDR:%.*]] = getelementptr inbounds i8, i8* [[CLASS_BYTE_ARRAY]], i64 [[Y_OFFSET]]
// CHECK: bitcast i8* [[Y_ADDR]] to %swift.opaque*
sil [ossa] @RootGeneric_concrete_fragile_dependent_member_access_y : $<F> (RootGeneric<F>) -> @out F {
entry(%z : $*F, %c : @unowned $RootGeneric<F>):
sil @RootGeneric_concrete_fragile_dependent_member_access_y : $<F> (RootGeneric<F>) -> @out F {
entry(%z : $*F, %c : $RootGeneric<F>):
%p = ref_element_addr %c : $RootGeneric<F>, #RootGeneric.y
copy_addr %p to [initialization] %z : $*F
%t = tuple ()
Expand All @@ -292,8 +292,8 @@ entry(%z : $*F, %c : @unowned $RootGeneric<F>):
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @RootGeneric_subst_concrete_fragile_dependent_member_access_y
// CHECK: [[Y_ADDR:%.*]] = getelementptr inbounds {{.*}}, {{.*}}* %1, i32 0, i32 3
// CHECK: bitcast %TSi* [[Y_ADDR]] to i8*
sil [ossa] @RootGeneric_subst_concrete_fragile_dependent_member_access_y : $(RootGeneric<Int>) -> @out Int {
entry(%z : $*Int, %c : @unowned $RootGeneric<Int>):
sil @RootGeneric_subst_concrete_fragile_dependent_member_access_y : $(RootGeneric<Int>) -> @out Int {
entry(%z : $*Int, %c : $RootGeneric<Int>):
%p = ref_element_addr %c : $RootGeneric<Int>, #RootGeneric.y
copy_addr %p to [initialization] %z : $*Int
%t = tuple ()
Expand All @@ -308,21 +308,21 @@ entry(%z : $*Int, %c : @unowned $RootGeneric<Int>):
// CHECK: [[CLASS_BYTE_ARRAY:%.*]] = bitcast [[ROOTGENERIC]]* {{%.*}} to i8*
// CHECK: [[Z_ADDR:%.*]] = getelementptr inbounds i8, i8* [[CLASS_BYTE_ARRAY]], i64 [[Z_OFFSET]]
// CHECK: bitcast i8* [[Z_ADDR]] to %Ts5UInt8V*
sil [ossa] @RootGeneric_concrete_fragile_dependent_member_access_z : $<F> (RootGeneric<F>) -> UInt8 {
entry(%c : @unowned $RootGeneric<F>):
sil @RootGeneric_concrete_fragile_dependent_member_access_z : $<F> (RootGeneric<F>) -> UInt8 {
entry(%c : $RootGeneric<F>):
%p = ref_element_addr %c : $RootGeneric<F>, #RootGeneric.z
%z = load_borrow %p : $*UInt8
%z = load %p : $*UInt8
return %z : $UInt8
}

// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc i8 @RootGeneric_subst_concrete_fragile_dependent_member_access_z
// CHECK: [[Z_ADDR:%.*]] = getelementptr inbounds {{.*}}, {{.*}}* %0, i32 0, i32 4
// CHECK: [[T0:%.*]] = getelementptr inbounds %Ts5UInt8V, %Ts5UInt8V* [[Z_ADDR]], i32 0, i32 0
// CHECK: load i8, i8* [[T0]], align
sil [ossa] @RootGeneric_subst_concrete_fragile_dependent_member_access_z : $(RootGeneric<Int>) -> UInt8 {
entry(%c : @unowned $RootGeneric<Int>):
sil @RootGeneric_subst_concrete_fragile_dependent_member_access_z : $(RootGeneric<Int>) -> UInt8 {
entry(%c : $RootGeneric<Int>):
%p = ref_element_addr %c : $RootGeneric<Int>, #RootGeneric.z
%z = load_borrow %p : $*UInt8
%z = load %p : $*UInt8
return %z : $UInt8
}

Expand Down
92 changes: 0 additions & 92 deletions test/IRGen/ownership_qualified_memopts.sil

This file was deleted.

26 changes: 13 additions & 13 deletions test/IRGen/protocol_with_superclass.sil
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MoreDerived : Concrete, SubProto {}

// CHECK-objc-LABEL: define hidden swiftcc void @checkExistentialDowncast(%T24protocol_with_superclass8ConcreteC*, {{.*}} {
// CHECK-native-LABEL: define hidden swiftcc void @checkExistentialDowncast(%T24protocol_with_superclass8ConcreteC*, %swift.refcounted*, i8**, %T24protocol_with_superclass8ConcreteC*, i8**, %T24protocol_with_superclass8ConcreteC*, i8**, %T24protocol_with_superclass8ConcreteC*, i8**) {{.*}} {
sil hidden [ossa] @checkExistentialDowncast : $@convention(thin) (@owned Concrete, @owned SuperProto, @owned SuperProto & Concrete, @owned ProtoRefinesClass, @owned SubProto) -> () {
sil hidden @checkExistentialDowncast : $@convention(thin) (@owned Concrete, @owned SuperProto, @owned SuperProto & Concrete, @owned ProtoRefinesClass, @owned SubProto) -> () {
bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRefinesClass, %4 : $SubProto):

// CHECK: [[ISA_ADDR:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %0 to %swift.type**
Expand All @@ -39,7 +39,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%5 = unconditional_checked_cast %0 : $Concrete to $ProtoRefinesClass

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass8ConcreteC*)*)(%T24protocol_with_superclass8ConcreteC* [[REFERENCE]])
destroy_value %5 : $ProtoRefinesClass
strong_release %5 : $ProtoRefinesClass

// CHECK: [[ISA_ADDR:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %0 to %swift.type**
// CHECK-NEXT: [[ISA:%.*]] = load %swift.type*, %swift.type** [[ISA_ADDR]]
Expand All @@ -50,7 +50,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%6 = unconditional_checked_cast %0 : $Concrete to $SubProto

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass8ConcreteC*)*)(%T24protocol_with_superclass8ConcreteC* [[REFERENCE]])
destroy_value %6 : $SubProto
strong_release %6 : $SubProto

// CHECK-objc: [[ISA:%.*]] = call %swift.type* @swift_getObjectType(%objc_object* %{{[0-9]+}})
// CHECK-objc-NEXT: [[OBJECT:%.*]] = bitcast %objc_object* %{{[0-9]+}} to i8*
Expand All @@ -63,7 +63,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%7 = unconditional_checked_cast %1 : $SuperProto to $ProtoRefinesClass

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass8ConcreteC*)*)(%T24protocol_with_superclass8ConcreteC* [[REFERENCE]])
destroy_value %7 : $ProtoRefinesClass
strong_release %7 : $ProtoRefinesClass

// CHECK-objc: [[ISA:%.*]] = call %swift.type* @swift_getObjectType(%objc_object* %{{[0-9]+}})
// CHECK-objc-NEXT: [[OBJECT:%.*]] = bitcast %objc_object* %{{[0-9]+}} to i8*
Expand All @@ -76,7 +76,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%8 = unconditional_checked_cast %1 : $SuperProto to $SubProto

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass8ConcreteC*)*)(%T24protocol_with_superclass8ConcreteC* [[REFERENCE]])
destroy_value %8 : $SubProto
strong_release %8 : $SubProto

// CHECK: [[ISA_ADDR:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %{{[0-9]+}} to %swift.type**
// CHECK-NEXT: [[ISA:%.*]] = load %swift.type*, %swift.type** [[ISA_ADDR]]
Expand All @@ -87,7 +87,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%9 = unconditional_checked_cast %2 : $SuperProto & Concrete to $ProtoRefinesClass

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass8ConcreteC*)*)(%T24protocol_with_superclass8ConcreteC* [[REFERENCE]])
destroy_value %9 : $ProtoRefinesClass
strong_release %9 : $ProtoRefinesClass

// CHECK: [[ISA_ADDR:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %{{[0-9]+}} to %swift.type**
// CHECK-NEXT: [[ISA:%.*]] = load %swift.type*, %swift.type** [[ISA_ADDR]]
Expand All @@ -98,7 +98,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%10 = unconditional_checked_cast %2 : $SuperProto & Concrete to $SubProto

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass8ConcreteC*)*)(%T24protocol_with_superclass8ConcreteC* [[REFERENCE]])
destroy_value %10 : $SubProto
strong_release %10 : $SubProto

// CHECK: [[OBJECT:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %{{[0-9]+}} to i8*
// CHECK-NEXT: [[RESPONSE:%.*]] = call swiftcc %swift.metadata_response @"$s24protocol_with_superclass7DerivedCMa"(i{{[0-9]+}} 0)
Expand All @@ -109,7 +109,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%11 = unconditional_checked_cast %3 : $ProtoRefinesClass to $Derived

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass7DerivedC*)*)(%T24protocol_with_superclass7DerivedC* [[REFERENCE]])
destroy_value %11 : $Derived
strong_release %11 : $Derived

// CHECK: [[OBJECT:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %{{[0-9]+}} to i8*
// CHECK-NEXT: [[RESPONSE:%.*]] = call swiftcc %swift.metadata_response @"$s24protocol_with_superclass10SubDerivedCMa"(i{{[0-9]+}} 0)
Expand All @@ -120,7 +120,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%12 = unconditional_checked_cast %3 : $ProtoRefinesClass to $SubDerived

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass10SubDerivedC*)*)(%T24protocol_with_superclass10SubDerivedC* [[REFERENCE]])
destroy_value %12 : $SubDerived
strong_release %12 : $SubDerived

// CHECK: [[ISA_ADDR:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %{{[0-9]+}} to %swift.type**
// CHECK-NEXT: [[ISA:%.*]] = load %swift.type*, %swift.type** [[ISA_ADDR]]
Expand All @@ -131,7 +131,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%13 = unconditional_checked_cast %3 : $ProtoRefinesClass to $OtherProto & Concrete

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass8ConcreteC*)*)(%T24protocol_with_superclass8ConcreteC* [[REFERENCE]])
destroy_value %13 : $OtherProto & Concrete
strong_release %13 : $OtherProto & Concrete

// CHECK: [[ISA_ADDR:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %{{[0-9]+}} to %swift.type**
// CHECK-NEXT: [[ISA:%.*]] = load %swift.type*, %swift.type** [[ISA_ADDR]]
Expand All @@ -144,7 +144,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%14 = unconditional_checked_cast %3 : $ProtoRefinesClass to $OtherProto & SubConcrete

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass11SubConcreteC*)*)(%T24protocol_with_superclass11SubConcreteC* [[REFERENCE]])
destroy_value %14 : $OtherProto & SubConcrete
strong_release %14 : $OtherProto & SubConcrete

// CHECK: [[OBJECT:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %{{[0-9]+}} to i8*
// CHECK-NEXT: [[RESPONSE:%.*]] = call swiftcc %swift.metadata_response @"$s24protocol_with_superclass11MoreDerivedCMa"(i{{[0-9]+}} 0)
Expand All @@ -155,7 +155,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%15 = unconditional_checked_cast %4 : $SubProto to $MoreDerived

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass11MoreDerivedC*)*)(%T24protocol_with_superclass11MoreDerivedC* [[REFERENCE]])
destroy_value %15 : $MoreDerived
strong_release %15 : $MoreDerived

// CHECK: [[ISA_ADDR:%.*]] = bitcast %T24protocol_with_superclass8ConcreteC* %{{[0-9]+}} to %swift.type**
// CHECK-NEXT: [[ISA:%.*]] = load %swift.type*, %swift.type** [[ISA_ADDR]]
Expand All @@ -166,7 +166,7 @@ bb0(%0 : $Concrete, %1 : $SuperProto, %2 : $SuperProto & Concrete, %3 : $ProtoRe
%16 = unconditional_checked_cast %4 : $SubProto to $OtherProto & Concrete

// CHECK: call void bitcast (void (%swift.refcounted*)* @swift_release to void (%T24protocol_with_superclass8ConcreteC*)*)(%T24protocol_with_superclass8ConcreteC* [[REFERENCE]])
destroy_value %16 : $OtherProto & Concrete
strong_release %16 : $OtherProto & Concrete

%result = tuple ()
return %result : $()
Expand Down
Loading