File: accesspath_unit.sil

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (172 lines) | stat: -rw-r--r-- 7,349 bytes parent folder | download
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// RUN: %target-sil-opt -test-runner %s -o /dev/null 2>&1 | %FileCheck %s

sil_stage raw

import Builtin

import Swift

struct S {}

class Klass {
  var f: S
}

struct S2 {
  var f: S
  var k: Klass
}

sil_global hidden @globalKlass : $Klass
sil_global hidden @globalStruct : $S2

// CHECK-LABEL: begin running test 1 of 2 on testRefElement: accesspath-base with: @trace[0]
// CHECK: [[P1:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*S
// CHECK: [[P2:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*S
// CHECK: Access path base:  [[P1]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK-NEXT: Exact Use:   %{{.*}} = load [trivial] [[A1]] : $*S
// CHECK-NEXT: Exact Use:   end_access [[A1]] : $*S
// CHECK: end running test 1 of 2 on testRefElement: accesspath-base with: @trace[0]

// CHECK-LABEL: begin running test 2 of 2 on testRefElement: accesspath-base with: @trace[1]
// CHECK: [[P1:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*S
// CHECK: [[P2:%.*]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*S
// CHECK: Access path base:  [[P2]] = ref_element_addr %0 : $Klass, #Klass.f
// CHECK-NEXT: Exact Use:   %{{.*}} = load [trivial] [[A2]] : $*S
// CHECK-NEXT: Exact Use:   end_access [[A2]] : $*S
// CHECK: end running test 2 of 2 on testRefElement: accesspath-base with: @trace[1]
sil hidden [ossa] @testRefElement : $@convention(thin) (@guaranteed Klass) -> () {
bb0(%0 : @guaranteed $Klass):
  specify_test "accesspath-base @trace[0]"
  %p1 = ref_element_addr %0 : $Klass, #Klass.f
  debug_value [trace] %p1 : $*S
  %a1 = begin_access [read] [dynamic] %p1 : $*S
  %l1 = load [trivial] %a1 : $*S
  end_access %a1 : $*S
  specify_test "accesspath-base @trace[1]"
  %p2 = ref_element_addr %0 : $Klass, #Klass.f
  debug_value [trace] %p2 : $*S
  %a2 = begin_access [read] [dynamic] %p2 : $*S
  %l2 = load [trivial] %a2 : $*S
  end_access %a2 : $*S
  %99 = tuple ()
  return %99 : $()
}

// CHECK-LABEL: begin running test 1 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[0]
// CHECK: [[P1:%.*]] = global_addr @globalKlass : $*Klass
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*Klass
// CHECK: [[P2:%.*]] = global_addr @globalKlass : $*Klass
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*Klass
// CHECK: Access path base:  [[P1]] = global_addr @globalKlass : $*Klass
// CHECK-NEXT: Exact Use:   %{{.*}} = load_borrow [[A1]]
// CHECK-NEXT: Exact Use:   end_access [[A1]]
// CHECK: end running test 1 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[0]

// CHECK-LABEL: begin running test 2 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[1]
// CHECK: [[P1:%.*]] = global_addr @globalKlass : $*Klass
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]] : $*Klass
// CHECK: [[P2:%.*]] = global_addr @globalKlass : $*Klass
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]] : $*Klass
// CHECK: Access path base:  [[P2]] = global_addr @globalKlass : $*Klass
// CHECK-NEXT: Exact Use:   %{{.*}} = load_borrow [[A2]]
// CHECK-NEXT: Exact Use:   end_access [[A2]]
// CHECK: end running test 2 of 2 on testGlobalAddrKlass: accesspath-base with: @trace[1]
sil [ossa] @testGlobalAddrKlass : $@convention(thin) () -> () {
bb0:
  specify_test "accesspath-base @trace[0]"
  %p1 = global_addr @globalKlass : $*Klass
  debug_value [trace] %p1 : $*Klass
  %a1 = begin_access [read] [dynamic] %p1 : $*Klass
  %l1 = load_borrow %a1 : $*Klass
  end_borrow %l1 : $Klass
  end_access %a1 : $*Klass

  specify_test "accesspath-base @trace[1]"
  %p2 = global_addr @globalKlass : $*Klass
  debug_value [trace] %p2 : $*Klass
  %a2 = begin_access [read] [dynamic] %p2 : $*Klass
  %l2 = load_borrow %a2 : $*Klass
  end_borrow %l2 : $Klass
  end_access %a2 : $*Klass

  %9999 = tuple ()
  return %9999 : $()
}

// CHECK-LABEL: begin running test 1 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[0]
// CHECK: [[P1:%.*]] = global_addr @globalStruct
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
// CHECK: [[P2:%.*]] = global_addr @globalStruct
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]]
// CHECK: [[GEP2:%.*]] = struct_element_addr [[A2]]
// CHECK: [[P3:%.*]] = global_addr @globalStruct
// CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
// CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
// CHECK: Access path base:  [[P1]] = global_addr @globalStruct
// CHECK-NEXT: Exact Use:   %{{.*}} = load_borrow [[A1]]
// CHECK-NEXT: Exact Use:   end_access [[A1]]
// CHECK: end running test 1 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[0]

// CHECK-LABEL: begin running test 2 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[1]
// CHECK: [[P1:%.*]] = global_addr @globalStruct
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
// CHECK: [[P2:%.*]] = global_addr @globalStruct
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]]
// CHECK: [[GEP2:%.*]] = struct_element_addr [[A2]]
// CHECK: [[P3:%.*]] = global_addr @globalStruct
// CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
// CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
// CHECK: Access path base:  [[P2]] = global_addr @globalStruct
// CHECK-NEXT: Inner Use:   %{{.*}} = load_borrow [[GEP2]]
// CHECK-NEXT: Exact Use:   end_access [[A2]]
// CHECK: end running test 2 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[1]

// CHECK-LABEL: begin running test 3 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[2]
// CHECK: [[P1:%.*]] = global_addr @globalStruct
// CHECK: [[A1:%.*]] = begin_access [read] [dynamic] [[P1]]
// CHECK: [[P2:%.*]] = global_addr @globalStruct
// CHECK: [[A2:%.*]] = begin_access [read] [dynamic] [[P2]]
// CHECK: [[GEP2:%.*]] = struct_element_addr [[A2]]
// CHECK: [[P3:%.*]] = global_addr @globalStruct
// CHECK: [[A3:%.*]] = begin_access [read] [dynamic] [[P3]]
// CHECK: [[GEP3:%.*]] = struct_element_addr [[A3]]
// CHECK: Access path base:  [[P3]] = global_addr @globalStruct
// CHECK-NEXT: Inner Use:   %{{.*}} = load_borrow [[GEP3]]
// CHECK-NEXT: Exact Use:   end_access [[A3]]
// CHECK: end running test 3 of 3 on testGlobalAddrStruct: accesspath-base with: @trace[2]
sil [ossa] @testGlobalAddrStruct : $@convention(thin) () -> () {
bb0:
  specify_test "accesspath-base @trace[0]"
  %p3 = global_addr @globalStruct : $*S2
  debug_value [trace] %p3 : $*S2
  %a3 = begin_access [read] [dynamic] %p3 : $*S2
  %l3 = load_borrow %a3 : $*S2
  end_borrow %l3 : $S2
  end_access %a3 : $*S2

  specify_test "accesspath-base @trace[1]"
  %p4 = global_addr @globalStruct : $*S2
  debug_value [trace] %p4 : $*S2
  %a4 = begin_access [read] [dynamic] %p4 : $*S2
  %gep4 = struct_element_addr %a4 : $*S2, #S2.k
  %l4 = load_borrow %gep4 : $*Klass
  end_borrow %l4 : $Klass
  end_access %a4 : $*S2

  specify_test "accesspath-base @trace[2]"
  %p5 = global_addr @globalStruct : $*S2
  debug_value [trace] %p5 : $*S2
  %a5 = begin_access [read] [dynamic] %p5 : $*S2
  %gep5 = struct_element_addr %a5 : $*S2, #S2.k
  %l5 = load_borrow %gep5 : $*Klass
  end_borrow %l5 : $Klass
  end_access %a5 : $*S2

  %9999 = tuple()
  return %9999 : $()
}