Skip to content

Commit 9da65ca

Browse files
authored
Merge pull request #66865 from aschwaighofer/fix_opaque_pointer_irgen_armv7k
Fix some IRGen tests on armv7k for opaque pointers
2 parents 1980da9 + 5eee766 commit 9da65ca

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

test/IRGen/abi_v7k.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func testRet3() -> MyRect2 {
296296
}
297297

298298
// Returning tuple?: (Int x 6)?
299-
// CHECK-LABEL: define hidden swiftcc void @"$s8test_v7k7minMax2{{.*}}"({{%TSi.*}} noalias nocapture sret({{.*}}) %0, i32 %1, i32 %2)
299+
// CHECK-LABEL: define hidden swiftcc void @"$s8test_v7k7minMax2{{.*}}"(ptr noalias nocapture sret({{.*}}) %0, i32 %1, i32 %2)
300300
// V7K-LABEL: _$s8test_v7k7minMax2
301301
// We will indirectly return an optional with the address in r0, input parameters will be in r1 and r2
302302
// V7K: str r0, [sp, [[IDX:#[0-9]+]]]
@@ -324,7 +324,7 @@ func minMax2(x : Int, y : Int) -> (min: Int, max: Int, min2: Int, max2: Int, min
324324
}
325325

326326
// Returning struct?: {Int x 6}?
327-
// CHECK-LABEL: define hidden swiftcc void @"$s8test_v7k7minMax3{{.*}}"({{%T.*}} noalias nocapture sret({{.*}}) %0, i32 %1, i32 %2)
327+
// CHECK-LABEL: define hidden swiftcc void @"$s8test_v7k7minMax3{{.*}}"(ptr noalias nocapture sret({{.*}}) %0, i32 %1, i32 %2)
328328
// V7K-LABEL: _$s8test_v7k7minMax3
329329
struct Ret {
330330
var min:Int

test/IRGen/abitypes.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ class Foo {
175175
// armv7k-watchos: load ptr, ptr @"\01L_selector(newRect)", align 4
176176
// armv7k-watchos: [[RESULT:%.*]] = call [[ARMV7K_MYRECT]] @objc_msgSend
177177
// armv7k-watchos: store [[ARMV7K_MYRECT]] [[RESULT]]
178-
// armv7k-watchos: [[CAST:%.*]] = bitcast ptr
179-
// armv7k-watchos: load { float, float, float, float }, ptr [[CAST]]
178+
// armv7k-watchos: load { float, float, float, float }, ptr
180179
// armv7k-watchos: ret float
181180
func barc(_ p: StructReturns) -> Float {
182181
return p.newRect().y

test/IRGen/class_isa_pointers_armv7k_watchos.sil

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ class Purebred {
1717
}
1818
sil_vtable Purebred {}
1919

20-
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @purebred_method(%T33class_isa_pointers_armv7k_watchos8PurebredC* %0) {{.*}} {
21-
// CHECK: [[ISA_PTR:%.*]] = bitcast %T33class_isa_pointers_armv7k_watchos8PurebredC* %0 to %swift.type**
22-
// CHECK: [[ISA:%.*]] = load %swift.type*, %swift.type** [[ISA_PTR]]
23-
// CHECK: [[VTABLE:%.*]] = bitcast %swift.type* [[ISA]]
24-
// CHECK: getelementptr inbounds {{.*}} [[VTABLE]]
20+
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @purebred_method(ptr %0) {{.*}} {
21+
// CHECK: [[ISA:%.*]] = load ptr, ptr %0
22+
// CHECK: getelementptr inbounds {{.*}} [[ISA]]
2523
sil @purebred_method : $@convention(thin) (@owned Purebred) -> () {
2624
entry(%0 : $Purebred):
2725
%m = class_method %0 : $Purebred, #Purebred.method : (Purebred) -> () -> (), $@convention(method) (@guaranteed Purebred) -> ()
@@ -38,12 +36,9 @@ class Mongrel: Gizmo {
3836
}
3937
sil_vtable Mongrel {}
4038

41-
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @mongrel_method(%T33class_isa_pointers_armv7k_watchos7MongrelC* %0) {{.*}} {
42-
// CHECK: [[T0:%.*]] = bitcast {{.*}} %0 to %objc_object*
43-
// CHECK: [[T1:%.*]] = call %objc_class* @object_getClass(%objc_object* [[T0]])
44-
// CHECK: [[ISA:%.*]] = bitcast %objc_class* [[T1]] to %swift.type*
45-
// CHECK: [[VTABLE:%.*]] = bitcast %swift.type* [[ISA]]
46-
// CHECK: getelementptr inbounds {{.*}} [[VTABLE]]
39+
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @mongrel_method(ptr %0) {{.*}} {
40+
// CHECK: [[T1:%.*]] = call ptr @object_getClass(ptr %0)
41+
// CHECK: getelementptr inbounds {{.*}} [[T1]]
4742
sil @mongrel_method : $@convention(thin) (@owned Mongrel) -> () {
4843
entry(%0 : $Mongrel):
4944
%m = class_method %0 : $Mongrel, #Mongrel.method : (Mongrel) -> () -> (), $@convention(method) (@guaranteed Mongrel) -> ()

test/IRGen/objc_object_getClass.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ func test(_ o: ObjCSubclass) {
1818
o.field = 10
1919
}
2020

21-
// CHECK-DAG: declare i8* @object_getClass(i8*{{.*}})
22-
// CHECK-DAG: call %objc_class* bitcast (i8* (i8*)* @object_getClass to %objc_class* (%objc_object*)*)(%objc_object* %{{.*}})
21+
// CHECK-DAG: declare ptr @object_getClass(ptr{{.*}})
22+
// CHECK-DAG: call ptr @object_getClass(ptr %{{.*}})

0 commit comments

Comments
 (0)