forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray_value_witnesses.sil
136 lines (122 loc) · 7.79 KB
/
array_value_witnesses.sil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil %s -emit-ir | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
import Swift
class C {}
sil_vtable C {}
struct POD {
var x: Int
}
struct BitwiseTakable {
var x: C
}
struct SomeWeak {
var x: C
weak var y: C?
}
// CHECK-LABEL: @_T021array_value_witnesses3PODVWV =
// CHECK-NOT: @_T021array_value_witnesses3PODVwXx
// CHECK: @__swift_noop_void_return
// CHECK-NOT: @_T021array_value_witnesses3PODVwCc
// CHECK-32: @__swift_memcpy_array4_4
// CHECK-64: @__swift_memcpy_array8_8
// CHECK-NOT: @_T021array_value_witnesses3PODVwTt
// CHECK-32: @__swift_memmove_array4_4
// CHECK-64: @__swift_memmove_array8_8
// CHECK-NOT: @_T021array_value_witnesses3PODVwtT
// CHECK-32: @__swift_memmove_array4_4
// CHECK-64: @__swift_memmove_array8_8
// CHECK-LABEL: @_T021array_value_witnesses14BitwiseTakableVWV =
// CHECK: @_T021array_value_witnesses14BitwiseTakableVwXx
// CHECK: @_T021array_value_witnesses14BitwiseTakableVwCc
// CHECK-NOT: @_T021array_value_witnesses14BitwiseTakableVwTt
// CHECK-32: @__swift_memmove_array4_4
// CHECK-64: @__swift_memmove_array8_8
// CHECK-NOT: @_T021array_value_witnesses14BitwiseTakableVwtT
// CHECK-32: @__swift_memmove_array4_4
// CHECK-64: @__swift_memmove_array8_8
// CHECK-LABEL: @_T021array_value_witnesses8SomeWeakVWV =
// CHECK: @_T021array_value_witnesses8SomeWeakVwXx
// CHECK: @_T021array_value_witnesses8SomeWeakVwCc
// CHECK: @_T021array_value_witnesses8SomeWeakVwTt
// CHECK: @_T021array_value_witnesses8SomeWeakVwtT
// CHECK-LABEL: define linkonce_odr hidden void @_T021array_value_witnesses8SomeWeakVwXx
// CHECK: (%swift.opaque* [[ARRAY_PTR:%.*]], [[WORD:i[0-9]+]] [[COUNT:%.*]], %swift.type* %SomeWeak) {{.*}} {
// CHECK: [[BEGIN:%.*]] = bitcast %swift.opaque* [[ARRAY_PTR]] to [[SOMEWEAK:%T21array_value_witnesses8SomeWeakV]]*
// CHECK: br label %iter
// CHECK: iter:
// CHECK: [[I:%.*]] = phi [[WORD]] [ [[COUNT]], %entry ], [ [[DEC:%.*]], %loop ]
// CHECK: [[CURRENT:%.*]] = phi [[SOMEWEAK]]* [ [[BEGIN]], %entry ], [ [[NEXT:%.*]], %loop ]
// CHECK: [[DONE:%.*]] = icmp eq [[WORD]] [[I]], 0
// CHECK: br i1 [[DONE]], label %exit, label %loop
// CHECK: loop:
// CHECK: [[WEAK:%.*]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[CURRENT]], i32 0, i32 1
// CHECK: call void @swift_weakDestroy(%swift.weak* [[WEAK]])
// CHECK: [[DEC]] = sub [[WORD]] [[I]], 1
// CHECK: [[NEXT]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[CURRENT]], [[WORD]] 1
// CHECK: br label %iter
// CHECK: exit:
// CHECK: ret
// CHECK-LABEL: define linkonce_odr hidden %swift.opaque* @_T021array_value_witnesses8SomeWeakVwCc
// CHECK: (%swift.opaque* [[DEST_PTR:%.*]], %swift.opaque* [[SRC_PTR:%.*]], [[WORD:i[0-9]+]] [[COUNT:%.*]], %swift.type* %SomeWeak) {{.*}} {
// CHECK: [[DEST_BEGIN:%.*]] = bitcast %swift.opaque* [[DEST_PTR]] to [[SOMEWEAK]]*
// CHECK: [[SRC_BEGIN:%.*]] = bitcast %swift.opaque* [[SRC_PTR]] to [[SOMEWEAK]]*
// CHECK: br label %iter
// CHECK: iter:
// CHECK: [[I:%.*]] = phi [[WORD]] [ [[COUNT]], %entry ], [ [[DEC:%.*]], %loop ]
// CHECK: [[DEST_CURRENT:%.*]] = phi [[SOMEWEAK]]* [ [[DEST_BEGIN]], %entry ], [ [[DEST_NEXT:%.*]], %loop ]
// CHECK: [[SRC_CURRENT:%.*]] = phi [[SOMEWEAK]]* [ [[SRC_BEGIN]], %entry ], [ [[SRC_NEXT:%.*]], %loop ]
// CHECK: [[DONE:%.*]] = icmp eq [[WORD]] [[I]], 0
// CHECK: br i1 [[DONE]], label %exit, label %loop
// CHECK: loop:
// CHECK: [[DEST_WEAK:%.*]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[DEST_CURRENT]], i32 0, i32 1
// CHECK: [[SRC_WEAK:%.*]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[SRC_CURRENT]], i32 0, i32 1
// CHECK: call void @swift_weakCopyInit(%swift.weak* [[DEST_WEAK]], %swift.weak* [[SRC_WEAK]])
// CHECK: [[DEC]] = sub [[WORD]] [[I]], 1
// CHECK: [[DEST_NEXT]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[DEST_CURRENT]], [[WORD]] 1
// CHECK: [[SRC_NEXT]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[SRC_CURRENT]], [[WORD]] 1
// CHECK: br label %iter
// CHECK: exit:
// CHECK: ret
// CHECK-LABEL: define linkonce_odr hidden %swift.opaque* @_T021array_value_witnesses8SomeWeakVwTt
// CHECK: (%swift.opaque* [[DEST_PTR:%.*]], %swift.opaque* [[SRC_PTR:%.*]], [[WORD:i[0-9]+]] [[COUNT:%.*]], %swift.type* %SomeWeak) {{.*}} {
// CHECK: [[DEST_BEGIN:%.*]] = bitcast %swift.opaque* [[DEST_PTR]] to [[SOMEWEAK]]*
// CHECK: [[SRC_BEGIN:%.*]] = bitcast %swift.opaque* [[SRC_PTR]] to [[SOMEWEAK]]*
// CHECK: br label %iter
// CHECK: iter:
// CHECK: [[I:%.*]] = phi [[WORD]] [ [[COUNT]], %entry ], [ [[DEC:%.*]], %loop ]
// CHECK: [[DEST_CURRENT:%.*]] = phi [[SOMEWEAK]]* [ [[DEST_BEGIN]], %entry ], [ [[DEST_NEXT:%.*]], %loop ]
// CHECK: [[SRC_CURRENT:%.*]] = phi [[SOMEWEAK]]* [ [[SRC_BEGIN]], %entry ], [ [[SRC_NEXT:%.*]], %loop ]
// CHECK: [[DONE:%.*]] = icmp eq [[WORD]] [[I]], 0
// CHECK: br i1 [[DONE]], label %exit, label %loop
// CHECK: loop:
// CHECK: [[DEST_WEAK:%.*]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[DEST_CURRENT]], i32 0, i32 1
// CHECK: [[SRC_WEAK:%.*]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[SRC_CURRENT]], i32 0, i32 1
// CHECK: call void @swift_weakTakeInit(%swift.weak* [[DEST_WEAK]], %swift.weak* [[SRC_WEAK]])
// CHECK: [[DEC]] = sub [[WORD]] [[I]], 1
// CHECK: [[DEST_NEXT]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[DEST_CURRENT]], [[WORD]] 1
// CHECK: [[SRC_NEXT]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[SRC_CURRENT]], [[WORD]] 1
// CHECK: br label %iter
// CHECK: exit:
// CHECK: ret
// CHECK-LABEL: define linkonce_odr hidden %swift.opaque* @_T021array_value_witnesses8SomeWeakVwtT
// CHECK: (%swift.opaque* [[DEST_PTR:%.*]], %swift.opaque* [[SRC_PTR:%.*]], [[WORD:i[0-9]+]] [[COUNT:%.*]], %swift.type* %SomeWeak) {{.*}} {
// CHECK: [[DEST_BEGIN:%.*]] = bitcast %swift.opaque* [[DEST_PTR]] to [[SOMEWEAK]]*
// CHECK: [[SRC_BEGIN:%.*]] = bitcast %swift.opaque* [[SRC_PTR]] to [[SOMEWEAK]]*
// CHECK: [[DEST_END:%.*]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[DEST_BEGIN]], [[WORD]] [[COUNT]]
// CHECK: [[SRC_END:%.*]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[SRC_BEGIN]], [[WORD]] [[COUNT]]
// CHECK: br label %iter
// CHECK: iter:
// CHECK: [[I:%.*]] = phi [[WORD]] [ [[COUNT]], %entry ], [ [[DEC:%.*]], %loop ]
// CHECK: [[DEST_PREV:%.*]] = phi [[SOMEWEAK]]* [ [[DEST_END]], %entry ], [ [[DEST_CURRENT:%.*]], %loop ]
// CHECK: [[SRC_PREV:%.*]] = phi [[SOMEWEAK]]* [ [[SRC_END]], %entry ], [ [[SRC_CURRENT:%.*]], %loop ]
// CHECK: [[DONE:%.*]] = icmp eq [[WORD]] [[I]], 0
// CHECK: br i1 [[DONE]], label %exit, label %loop
// CHECK: loop:
// CHECK: [[DEST_CURRENT]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[DEST_PREV]], [[WORD]] -1
// CHECK: [[SRC_CURRENT]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[SRC_PREV]], [[WORD]] -1
// CHECK: [[DEST_WEAK:%.*]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[DEST_CURRENT]], i32 0, i32 1
// CHECK: [[SRC_WEAK:%.*]] = getelementptr inbounds [[SOMEWEAK]], [[SOMEWEAK]]* [[SRC_CURRENT]], i32 0, i32 1
// CHECK: call void @swift_weakTakeInit(%swift.weak* [[DEST_WEAK]], %swift.weak* [[SRC_WEAK]])
// CHECK: [[DEC]] = sub [[WORD]] [[I]], 1
// CHECK: br label %iter
// CHECK: exit:
// CHECK: ret