Skip to content

Commit 6253cd8

Browse files
meg-guptaaschwaighofer
authored andcommitted
Update some more IRGen tests to opaque pointer
1 parent 3239400 commit 6253cd8

12 files changed

+466
-642
lines changed

test/IRGen/partial_apply_forwarder.sil

Lines changed: 68 additions & 87 deletions
Large diffs are not rendered by default.

test/IRGen/pre_specialize.swift

Lines changed: 28 additions & 44 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-swift-frontend %use_no_opaque_pointers -emit-ir -primary-file %s %S/Inputs/protocol_accessor_multifile_other.swift > %t.ll
2-
// RUN: %target-swift-frontend -emit-ir -primary-file %s %S/Inputs/protocol_accessor_multifile_other.swift
1+
// RUN: %target-swift-frontend -emit-ir -primary-file %s %S/Inputs/protocol_accessor_multifile_other.swift > %t.ll
32
// RUN: %FileCheck %s -check-prefix CHECK -check-prefix CHECK-%target-runtime < %t.ll
43
// RUN: %FileCheck -check-prefix NEGATIVE %s < %t.ll
54

@@ -9,30 +8,28 @@
98
// CHECK-LABEL: define{{.*}} void @"$s27protocol_accessor_multifile14useExistentialyyF"()
109
func useExistential() {
1110
// CHECK: [[BOX:%.+]] = alloca %T27protocol_accessor_multifile5ProtoP,
12-
// CHECK: call swiftcc void @"$s27protocol_accessor_multifile17globalExistentialAA5Proto_pvg"(%T27protocol_accessor_multifile5ProtoP* noalias nocapture sret({{.*}}) [[BOX]])
11+
// CHECK: call swiftcc void @"$s27protocol_accessor_multifile17globalExistentialAA5Proto_pvg"(ptr noalias nocapture sret({{.*}}) [[BOX]])
1312
// CHECK: call swiftcc void @"$s27protocol_accessor_multifile5ProtoPAAE6methodyyF"
1413
globalExistential.method()
15-
// CHECK: [[BITCAST:%.*]] = bitcast %T27protocol_accessor_multifile5ProtoP* [[BOX]] to %__opaque_existential_type_1*
16-
// CHECK: call void @__swift_destroy_boxed_opaque_existential_1(%__opaque_existential_type_1* [[BITCAST]])
14+
// CHECK: call void @__swift_destroy_boxed_opaque_existential_1(ptr [[BOX]])
1715
// CHECK: ret void
1816
}
1917

2018
class GenericContext<T: Proto> {
2119
// CHECK-LABEL: define{{.*}} void @"$s27protocol_accessor_multifile14GenericContextC04testdE0yyFZ
2220
static func testGenericContext() {
23-
// CHECK: [[SELF:%.+]] = bitcast %swift.type* %0 to %swift.type**
24-
// CHECK: [[WITNESS_TABLE:%.+]] = getelementptr inbounds %swift.type*, %swift.type** [[SELF]],
25-
// CHECK: = load %swift.type*, %swift.type** [[WITNESS_TABLE]]
21+
// CHECK: [[WITNESS_TABLE:%.+]] = getelementptr inbounds ptr, ptr %0,
22+
// CHECK: = load ptr, ptr [[WITNESS_TABLE]]
2623
// CHECK: ret void
2724
}
2825
}
2926

3027
// CHECK-LABEL: define{{.*}} void @"$s27protocol_accessor_multifile19useClassExistentialyyF"()
3128
func useClassExistential() {
3229
let g = getClassExistential()
33-
// CHECK-objc: [[G_TYPE:%.+]] = call %swift.type* @swift_getObjectType({{%.+}} {{%.+}})
34-
// CHECK-native: [[G_TYPE:%.+]] = load %swift.type*
35-
// CHECK: call swiftcc void {{%.+}}(i{{32|64}} 1, {{%.+}} {{%.+}}, %swift.type* [[G_TYPE]], i8** {{%.+}})
30+
// CHECK-objc: [[G_TYPE:%.+]] = call ptr @swift_getObjectType(ptr {{%.+}})
31+
// CHECK-native: [[G_TYPE:%.+]] = load ptr
32+
// CHECK: call swiftcc void {{%.+}}(i{{32|64}} 1, ptr swiftself {{%.+}}, ptr [[G_TYPE]], ptr {{%.+}})
3633
g?.baseProp = 1
3734
// CHECK: ret void
3835
}

test/IRGen/protocol_resilience_thunks.swift

Lines changed: 53 additions & 64 deletions
Large diffs are not rendered by default.

test/IRGen/relative_protocol_witness_table.swift

Lines changed: 117 additions & 133 deletions
Large diffs are not rendered by default.

test/IRGen/simple_partial_apply.sil

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-swift-frontend %use_no_opaque_pointers -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-cpu
2-
// RUN: %target-swift-frontend -emit-ir %s
1+
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-cpu
32

43
sil_stage canonical
54

@@ -15,9 +14,9 @@ struct SingleRefcounted {
1514

1615
// CHECK-LABEL: define {{.*}} @escape_partial_apply_swift_class
1716
// CHECK-arm64e: call i64 @llvm.ptrauth.resign
18-
// CHECK: [[FPTR:%.*]] = insertvalue { i8*, %swift.refcounted* } undef, i8* {{.*}}, 0
19-
// CHECK-NEXT: [[FCTX:%.*]] = insertvalue { i8*, %swift.refcounted* } [[FPTR]], %swift.refcounted* {{.*}}, 1
20-
// CHECK-NEXT: ret { i8*, %swift.refcounted* } [[FCTX]]
17+
// CHECK: [[FPTR:%.*]] = insertvalue { ptr, ptr } undef, ptr {{.*}}, 0
18+
// CHECK-NEXT: [[FCTX:%.*]] = insertvalue { ptr, ptr } [[FPTR]], ptr {{.*}}, 1
19+
// CHECK-NEXT: ret { ptr, ptr } [[FCTX]]
2120
sil @escape_partial_apply_swift_class : $@convention(thin) (@convention(method) (Int, @guaranteed C) -> Int, @guaranteed C) -> @callee_guaranteed (Int) -> Int {
2221
entry(%body : $@convention(method) (Int, @guaranteed C) -> Int, %context : $C):
2322
%closure = partial_apply [callee_guaranteed] %body(%context) : $@convention(method) (Int, @guaranteed C) -> Int
@@ -28,19 +27,16 @@ entry(%body : $@convention(method) (Int, @guaranteed C) -> Int, %context : $C):
2827

2928
// CHECK-LABEL: define {{.*}} @escape_partial_apply_swift_single_refcount_struct
3029
// CHECK: [[CTXT:%.*]] = call {{.*}} @swift_allocObject
31-
// CHECK: [[FCTX:%.*]] = insertvalue { i8*, %swift.refcounted* } { i8* bitcast ({{.*}}* @"$sTA{{.*}}" to i8*), %swift.refcounted* undef }, %swift.refcounted* [[CTXT]], 1
32-
// CHECK-NEXT: ret { i8*, %swift.refcounted* } [[FCTX]]
30+
// CHECK: [[FCTX:%.*]] = insertvalue { ptr, ptr } { ptr @"$sTA{{.*}}", ptr undef }, ptr [[CTXT]], 1
31+
// CHECK-NEXT: ret { ptr, ptr } [[FCTX]]
3332
sil @escape_partial_apply_swift_single_refcount_struct : $@convention(thin) (@convention(method) (Int, @guaranteed SingleRefcounted) -> Int, @guaranteed SingleRefcounted) -> @callee_guaranteed (Int) -> Int {
3433
entry(%body : $@convention(method) (Int, @guaranteed SingleRefcounted) -> Int, %context : $SingleRefcounted):
3534
%closure = partial_apply [callee_guaranteed] %body(%context) : $@convention(method) (Int, @guaranteed SingleRefcounted) -> Int
3635
return %closure : $@callee_guaranteed (Int) -> Int
3736
}
3837

3938
// CHECK-LABEL: define {{.*}} @noescape_partial_apply_swift_indirect
40-
// CHECK-arm64e: call i64 @llvm.ptrauth.resign
41-
// CHECK: [[CTX:%.*]] = bitcast {{.*}}** %1 to %swift.opaque*
42-
// CHECK-NEXT: [[CONT:%.*]] = bitcast i8* %2
43-
// CHECK-NEXT: call {{.*}}void [[CONT]](i8* {{.*}}, %swift.opaque* [[CTX]], %swift.refcounted* {{.*}}%3)
39+
// CHECK: call {{.*}}void %2(ptr {{.*}}, ptr %1, ptr {{.*}}%3)
4440
sil @noescape_partial_apply_swift_indirect : $@convention(thin) (@convention(method) (Int, @in_guaranteed C) -> Int, @in_guaranteed C, @guaranteed @callee_guaranteed (@noescape @callee_guaranteed (Int) -> Int) -> ()) -> () {
4541
entry(%body : $@convention(method) (Int, @in_guaranteed C) -> Int, %context : $*C, %cont : $@callee_guaranteed (@noescape @callee_guaranteed (Int) -> Int) -> ()):
4642
%closure = partial_apply [callee_guaranteed] [on_stack] %body(%context) : $@convention(method) (Int, @in_guaranteed C) -> Int
@@ -51,7 +47,7 @@ entry(%body : $@convention(method) (Int, @in_guaranteed C) -> Int, %context : $*
5147

5248
// Can't reuse the method because it does not have swiftself.
5349
// CHECK-LABEL: define {{.*}} @noescape_partial_apply_swift_direct_word
54-
// CHECK: call swiftcc void {{.*}}(i8* bitcast ({{.*}}* @"$sTA{{.*}}" to i8*), %swift.opaque* {{.*}}, %swift.refcounted* swiftself {{.*}})
50+
// CHECK: call swiftcc void {{.*}}(ptr @"$sTA{{.*}}", ptr {{.*}}, ptr swiftself {{.*}})
5551
sil @noescape_partial_apply_swift_direct_word : $@convention(thin) (@convention(method) (Int, Int) -> Int, Int, @guaranteed @callee_guaranteed (@noescape @callee_guaranteed (Int) -> Int) -> ()) -> () {
5652
entry(%body : $@convention(method) (Int, Int) -> Int, %context : $Int, %cont : $@callee_guaranteed (@noescape @callee_guaranteed (Int) -> Int) -> ()):
5753
%closure = partial_apply [callee_guaranteed] [on_stack] %body(%context) : $@convention(method) (Int, Int) -> Int

test/IRGen/simple_partial_apply_or_not.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-swift-emit-ir %use_no_opaque_pointers -Xllvm -sil-disable-pass=Simplification -module-name test %s | %FileCheck %s
2-
// RUN: %target-swift-emit-ir -Xllvm -sil-disable-pass=Simplification -module-name test %s
1+
// RUN: %target-swift-emit-ir -Xllvm -sil-disable-pass=Simplification -module-name test %s | %FileCheck %s
32
// RUN: %target-run-simple-swift -Xllvm -sil-disable-pass=Simplification %s | %FileCheck %s --check-prefix=CHECK-EXEC
43

54
// REQUIRES: executable_test
@@ -39,9 +38,9 @@ print(s)
3938
// because the ABI of closure requires swiftself in the context parameter but
4039
// the method of this self type (struct S) does not.
4140

42-
// CHECK: define {{.*}}swiftcc %T4test5StateV9Reference33_C903A018FCE7355FD30EF8324850EB90LLCySi_G* @"$s4test1SVACycfC"()
43-
// CHECK: call swiftcc void {{.*}}"$s4test1SV5valueSivsTA
44-
// CHECK: ret %T4test5StateV9Reference33_C903A018FCE7355FD30EF8324850EB90LLCySi_G
41+
// CHECK: define {{.*}}swiftcc ptr @"$s4test1SVACycfC"()
42+
// CHECK: [[RES:%.*]] = call swiftcc ptr @"$s4test1SV5valueSivpfP"(i64 1)
43+
// CHECK: ret ptr [[RES]]
4544

4645
// This used to crash.
4746

test/IRGen/struct_layout.sil

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
// RUN: %target-swift-frontend %use_no_opaque_pointers %s -module-name main -emit-ir -o - | %FileCheck -check-prefix=%target-ptrsize %s
2-
// RUN: %target-swift-frontend %s -module-name main -emit-ir -o -
1+
// RUN: %target-swift-frontend %s -module-name main -emit-ir -o - | %FileCheck -check-prefix=%target-ptrsize %s
32

43
import Builtin
54
import Swift
65

7-
// 64: %T4main14Rdar15410780_AV = type <{ i2048, %Ts4Int8V }>
8-
// 64: %T4main14Rdar15410780_BV = type <{ %T4main14Rdar15410780_AVSg }>
9-
// 64: %T4main14Rdar15410780_AVSg = type <{ [257 x i8], [1 x i8] }>
106
// 64: %T4main14Rdar15410780_CV = type <{ %TSSSg }>
117
// 64: %TSSSg = type <{ [16 x i8] }>
128

0 commit comments

Comments
 (0)