@@ -12,6 +12,14 @@ class Klass {
12
12
var f: S
13
13
}
14
14
15
+ struct S2 {
16
+ var f: S
17
+ var k: Klass
18
+ }
19
+
20
+ sil_global hidden @globalKlass : $Klass
21
+ sil_global hidden @globalStruct : $S2
22
+
15
23
// CHECK-LABEL: begin running test 1 of 2 on testRefElement: accesspath-base with: @trace[0]
16
24
// CHECK: [[P1:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
17
25
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*S
@@ -20,7 +28,7 @@ class Klass {
20
28
// CHECK: Access path base: [[P1]] = ref_element_addr %0 : $Klass, #Klass.f
21
29
// CHECK-NEXT: Exact Use: %{{.*}} = load [trivial] [[A1]] : $*S
22
30
// CHECK-NEXT: Exact Use: end_access [[A1]] : $*S
23
- // CHECK-LABEL : end running test 1 of 2 on testRefElement: accesspath-base with: @trace[0]
31
+ // CHECK: end running test 1 of 2 on testRefElement: accesspath-base with: @trace[0]
24
32
25
33
// CHECK-LABEL: begin running test 2 of 2 on testRefElement: accesspath-base with: @trace[1]
26
34
// CHECK: [[P1:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
@@ -30,7 +38,7 @@ class Klass {
30
38
// CHECK: Access path base: [[P2]] = ref_element_addr %0 : $Klass, #Klass.f
31
39
// CHECK-NEXT: Exact Use: %{{.*}} = load [trivial] [[A2]] : $*S
32
40
// CHECK-NEXT: Exact Use: end_access [[A2]] : $*S
33
- // CHECK-LABEL : end running test 2 of 2 on testRefElement: accesspath-base with: @trace[1]
41
+ // CHECK: end running test 2 of 2 on testRefElement: accesspath-base with: @trace[1]
34
42
sil hidden [ossa] @testRefElement : $@convention(thin) (@guaranteed Klass) -> () {
35
43
bb0(%0 : @guaranteed $Klass):
36
44
test_specification "accesspath-base @trace[0]"
@@ -48,3 +56,117 @@ bb0(%0 : @guaranteed $Klass):
48
56
%99 = tuple ()
49
57
return %99 : $()
50
58
}
59
+
60
+ // CHECK-LABEL: begin running test 1 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[0]
61
+ // CHECK: [[P1:%.*]] = global_addr @globalKlass : $*Klass
62
+ // CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*Klass
63
+ // CHECK: [[P2:%.*]] = global_addr @globalKlass : $*Klass
64
+ // CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*Klass
65
+ // CHECK: Access path base: [[P1]] = global_addr @globalKlass : $*Klass
66
+ // CHECK-NEXT: Exact Use: %{{.*}} = load_borrow [[A1]]
67
+ // CHECK-NEXT: Exact Use: end_access [[A1]]
68
+ // CHECK: end running test 1 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[0]
69
+
70
+ // CHECK-LABEL: begin running test 2 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[1]
71
+ // CHECK: [[P1:%.*]] = global_addr @globalKlass : $*Klass
72
+ // CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*Klass
73
+ // CHECK: [[P2:%.*]] = global_addr @globalKlass : $*Klass
74
+ // CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*Klass
75
+ // CHECK: Access path base: [[P2]] = global_addr @globalKlass : $*Klass
76
+ // CHECK-NEXT: Exact Use: %{{.*}} = load_borrow [[A2]]
77
+ // CHECK-NEXT: Exact Use: end_access [[A2]]
78
+ // CHECK: end running test 2 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[1]
79
+ sil [ossa] @testGlobalAddrKlass : $@convention(thin) () -> () {
80
+ bb0:
81
+ test_specification "accesspath-base @trace[0]"
82
+ %p1 = global_addr @globalKlass : $*Klass
83
+ debug_value [trace] %p1 : $*Klass
84
+ %a1 = begin_access [read] [dynamic] %p1 : $*Klass
85
+ %l1 = load_borrow %a1 : $*Klass
86
+ end_borrow %l1 : $Klass
87
+ end_access %a1 : $*Klass
88
+
89
+ test_specification "accesspath-base @trace[1]"
90
+ %p2 = global_addr @globalKlass : $*Klass
91
+ debug_value [trace] %p2 : $*Klass
92
+ %a2 = begin_access [read] [dynamic] %p2 : $*Klass
93
+ %l2 = load_borrow %a2 : $*Klass
94
+ end_borrow %l2 : $Klass
95
+ end_access %a2 : $*Klass
96
+
97
+ %9999 = tuple ()
98
+ return %9999 : $()
99
+ }
100
+
101
+ // CHECK-LABEL: begin running test 1 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[0]
102
+ // CHECK: [[P1:%.*]] = global_addr @globalStruct
103
+ // CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
104
+ // CHECK: [[P2:%.*]] = global_addr @globalStruct
105
+ // CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]]
106
+ // CHECK: [[GEP2:%.*]] = struct_element_addr [[A2]]
107
+ // CHECK: [[P3:%.*]] = global_addr @globalStruct
108
+ // CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
109
+ // CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
110
+ // CHECK: Access path base: [[P1]] = global_addr @globalStruct
111
+ // CHECK-NEXT: Exact Use: %{{.*}} = load_borrow [[A1]]
112
+ // CHECK-NEXT: Exact Use: end_access [[A1]]
113
+ // CHECK: end running test 1 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[0]
114
+
115
+ // CHECK-LABEL: begin running test 2 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[1]
116
+ // CHECK: [[P1:%.*]] = global_addr @globalStruct
117
+ // CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
118
+ // CHECK: [[P2:%.*]] = global_addr @globalStruct
119
+ // CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]]
120
+ // CHECK: [[GEP2:%.*]] = struct_element_addr [[A2]]
121
+ // CHECK: [[P3:%.*]] = global_addr @globalStruct
122
+ // CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
123
+ // CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
124
+ // CHECK: Access path base: [[P2]] = global_addr @globalStruct
125
+ // CHECK-NEXT: Inner Use: %{{.*}} = load_borrow [[GEP2]]
126
+ // CHECK-NEXT: Exact Use: end_access [[A2]]
127
+ // CHECK: end running test 2 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[1]
128
+
129
+ // CHECK-LABEL: begin running test 3 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[2]
130
+ // CHECK: [[P1:%.*]] = global_addr @globalStruct
131
+ // CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
132
+ // CHECK: [[P2:%.*]] = global_addr @globalStruct
133
+ // CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]]
134
+ // CHECK: [[GEP2:%.*]] = struct_element_addr [[A2]]
135
+ // CHECK: [[P3:%.*]] = global_addr @globalStruct
136
+ // CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
137
+ // CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
138
+ // CHECK: Access path base: [[P3]] = global_addr @globalStruct
139
+ // CHECK-NEXT: Inner Use: %{{.*}} = load_borrow [[GEP3]]
140
+ // CHECK-NEXT: Exact Use: end_access [[A3]]
141
+ // CHECK: end running test 3 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[2]
142
+ sil [ossa] @testGlobalAddrStruct : $@convention(thin) () -> () {
143
+ bb0:
144
+ test_specification "accesspath-base @trace[0]"
145
+ %p3 = global_addr @globalStruct : $*S2
146
+ debug_value [trace] %p3 : $*S2
147
+ %a3 = begin_access [read] [dynamic] %p3 : $*S2
148
+ %l3 = load_borrow %a3 : $*S2
149
+ end_borrow %l3 : $S2
150
+ end_access %a3 : $*S2
151
+
152
+ test_specification "accesspath-base @trace[1]"
153
+ %p4 = global_addr @globalStruct : $*S2
154
+ debug_value [trace] %p4 : $*S2
155
+ %a4 = begin_access [read] [dynamic] %p4 : $*S2
156
+ %gep4 = struct_element_addr %a4 : $*S2, #S2.k
157
+ %l4 = load_borrow %gep4 : $*Klass
158
+ end_borrow %l4 : $Klass
159
+ end_access %a4 : $*S2
160
+
161
+ test_specification "accesspath-base @trace[2]"
162
+ %p5 = global_addr @globalStruct : $*S2
163
+ debug_value [trace] %p5 : $*S2
164
+ %a5 = begin_access [read] [dynamic] %p5 : $*S2
165
+ %gep5 = struct_element_addr %a5 : $*S2, #S2.k
166
+ %l5 = load_borrow %gep5 : $*Klass
167
+ end_borrow %l5 : $Klass
168
+ end_access %a5 : $*S2
169
+
170
+ %9999 = tuple()
171
+ return %9999 : $()
172
+ }
0 commit comments