1
- // RUN: %target-swift-frontend %use_no_opaque_pointers -primary-file %s -emit-ir | %FileCheck %s
2
- // RUN: %target-swift-frontend -primary-file %s -emit-ir
3
- // RUN: %target-swift-frontend %use_no_opaque_pointers -primary-file %s -emit-ir | %FileCheck %s --check-prefix=CAPTURE
4
- // RUN: %target-swift-frontend %use_no_opaque_pointers -primary-file %s -O -emit-ir | %FileCheck %s --check-prefix=OPT
1
+ // RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s
2
+ // RUN: %target-swift-frontend -primary-file %s -emit-ir | %FileCheck %s --check-prefix=CAPTURE
3
+ // RUN: %target-swift-frontend -primary-file %s -O -emit-ir | %FileCheck %s --check-prefix=OPT
5
4
6
5
// REQUIRES: PTRSIZE=64
7
6
10
9
11
10
// -- partial_apply context metadata
12
11
13
- // CHECK-DAG: [[METADATA:@.*]] = private constant %swift.full_boxmetadata { void (%swift.refcounted*)* {{.*}}@objectdestroy{{(\.ptrauth.*)?}}, i8** null, %swift.type { i64 1024 }, i32 16, i8* bitcast ({ i32, i32, i32, i32 }* @"\01l__swift5_reflection_descriptor" to i8*) }
12
+ // CHECK-DAG: [[METADATA:@.*]] = private constant %swift.full_boxmetadata { ptr {{.*}}@objectdestroy{{(\.ptrauth.*)?}}, ptr null, %swift.type { i64 1024 }, i32 16, ptr @"\01l__swift5_reflection_descriptor" }
14
13
15
14
func a( i i: Int ) -> ( Int ) -> Int {
16
15
return { x in i }
@@ -28,30 +27,27 @@ func b<T : Ordinable>(seq seq: T) -> (Int) -> Int {
28
27
}
29
28
30
29
// -- partial_apply stub
31
- // CHECK: define internal swiftcc i64 @"$s7closure1a1iS2icSi_tFS2icfU_TA"(i64 %0, %swift.refcounted* swiftself %1)
30
+ // CHECK: define internal swiftcc i64 @"$s7closure1a1iS2icSi_tFS2icfU_TA"(i64 %0, ptr swiftself %1)
32
31
// CHECK: }
33
32
34
33
// -- Closure entry point
35
- // CHECK: define internal swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_"(i64 %0, %swift.opaque* noalias nocapture %1, %swift.type* %T, i8** %T.Ordinable) {{.*}} {
34
+ // CHECK: define internal swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_"(i64 %0, ptr noalias nocapture %1, ptr %T, ptr %T.Ordinable) {{.*}} {
36
35
37
36
// -- partial_apply stub
38
- // CHECK: define internal swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_TA"(i64 %0, %swift.refcounted* swiftself %1) {{.*}} {
37
+ // CHECK: define internal swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_TA"(i64 %0, ptr swiftself %1) {{.*}} {
39
38
// CHECK: entry:
40
- // CHECK: [[CONTEXT:%.*]] = bitcast %swift.refcounted* %1 to <{ %swift.refcounted, [16 x i8] }>*
41
- // CHECK: [[BINDINGSADDR:%.*]] = getelementptr inbounds <{ %swift.refcounted, [16 x i8] }>, <{ %swift.refcounted, [16 x i8] }>* [[CONTEXT]], i32 0, i32 1
42
- // CHECK: [[TYPEADDR:%.*]] = bitcast [16 x i8]* [[BINDINGSADDR]]
43
- // CHECK: [[TYPE:%.*]] = load %swift.type*, %swift.type** [[TYPEADDR]], align 8
44
- // CHECK: [[WITNESSADDR_0:%.*]] = getelementptr inbounds %swift.type*, %swift.type** [[TYPEADDR]], i32 1
45
- // CHECK: [[WITNESSADDR:%.*]] = bitcast %swift.type** [[WITNESSADDR_0]]
46
- // CHECK: [[WITNESS:%.*]] = load i8**, i8*** [[WITNESSADDR]], align 8
47
- // CHECK: [[RES:%.*]] = tail call swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_"(i64 %0, %swift.opaque* noalias nocapture {{.*}}, %swift.type* [[TYPE]], i8** [[WITNESS]])
39
+ // CHECK: [[BINDINGSADDR:%.*]] = getelementptr inbounds <{ %swift.refcounted, [16 x i8] }>, ptr %1, i32 0, i32 1
40
+ // CHECK: [[TYPE:%.*]] = load ptr, ptr [[BINDINGSADDR]], align 8
41
+ // CHECK: [[WITNESSADDR:%.*]] = getelementptr inbounds ptr, ptr [[BINDINGSADDR]], i32 1
42
+ // CHECK: [[WITNESS:%.*]] = load ptr, ptr [[WITNESSADDR]], align 8
43
+ // CHECK: [[RES:%.*]] = tail call swiftcc i64 @"$s7closure1b3seqS2icx_tAA9OrdinableRzlFS2icfU_"(i64 %0, ptr noalias nocapture {{.*}}, ptr [[TYPE]], ptr [[WITNESS]])
48
44
// CHECK: ret i64 [[RES]]
49
45
// CHECK: }
50
46
51
47
// -- <rdar://problem/14443343> Boxing of tuples with generic elements
52
- // CHECK: define hidden swiftcc { i8*, %swift.refcounted* } @"$s7closure14captures_tuple1xx_q_tycx_q_t_tr0_lF"(%swift.opaque* noalias nocapture %0, %swift.opaque* noalias nocapture %1, %swift.type* %T, %swift.type* %U)
48
+ // CHECK: define hidden swiftcc { ptr, ptr } @"$s7closure14captures_tuple1xx_q_tycx_q_t_tr0_lF"(ptr noalias nocapture %0, ptr noalias nocapture %1, ptr %T, ptr %U)
53
49
func captures_tuple< T, U> ( x x: ( T , U ) ) -> ( ) -> ( T , U ) {
54
- // CHECK: [[T0:%.*]] = call swiftcc %swift.metadata_response @swift_getTupleTypeMetadata2(i64 0, %swift.type* %T, %swift.type* %U, i8* null, i8** null)
50
+ // CHECK: [[T0:%.*]] = call swiftcc %swift.metadata_response @swift_getTupleTypeMetadata2(i64 0, ptr %T, ptr %U, ptr null, ptr null)
55
51
// CHECK-NEXT: [[METADATA:%.*]] = extractvalue %swift.metadata_response [[T0]], 0
56
52
// CHECK-NOT: @swift_getTupleTypeMetadata2
57
53
// CHECK: ret
@@ -67,10 +63,10 @@ func no_capture_descriptor(_ c: C, _ d: C, _ e: C, _ f: C, _ g: C) {
67
63
useClosure ( { _ = c ; _ = d ; _ = e ; _ = f ; _ = g } )
68
64
}
69
65
70
- // CHECK-LABEL: define hidden swiftcc { i8*, %swift.refcounted* } @"$s7closure9letEscape1fyycyyXE_tF"(i8* %0, %swift.opaque* %1)
71
- // CHECK: call zeroext i1 @swift_isEscapingClosureAtFileLocation(%swift.refcounted* {{.*}}, i8* getelementptr inbounds ({{.*}} [[FILENAME]]
72
- // OPT-LABEL: define hidden swiftcc { i8*, %swift.refcounted* } @"$s7closure9letEscape1fyycyyXE_tF"(i8* %0, %swift.opaque* %1)
73
- // OPT: call zeroext i1 @swift_isEscapingClosureAtFileLocation(%swift.refcounted* {{.*}}, i8* {{(nonnull )?}}getelementptr inbounds ({{.*}} [[FILENAME]]
66
+ // CHECK-LABEL: define hidden swiftcc { ptr, ptr } @"$s7closure9letEscape1fyycyyXE_tF"(ptr %0, ptr %1)
67
+ // CHECK: call zeroext i1 @swift_isEscapingClosureAtFileLocation(ptr {{.*}}, ptr [[FILENAME]]
68
+ // OPT-LABEL: define hidden swiftcc { ptr, ptr } @"$s7closure9letEscape1fyycyyXE_tF"(ptr %0, ptr %1)
69
+ // OPT: call zeroext i1 @swift_isEscapingClosureAtFileLocation(ptr {{.*}}, ptr {{(nonnull )?}}[[FILENAME]]
74
70
func letEscape( f: ( ) -> ( ) ) -> ( ) -> ( ) {
75
71
return withoutActuallyEscaping ( f) { return $0 }
76
72
}
0 commit comments