|
1 |
| -// RUN: %target-sil-opt -access-enforcement-opts -assume-parsing-unqualified-ownership-sil %s | %FileCheck %s |
| 1 | +// RUN: %target-sil-opt -access-enforcement-opts -I %S/Inputs/abi -assume-parsing-unqualified-ownership-sil %s | %FileCheck %s |
2 | 2 |
|
3 | 3 | sil_stage canonical
|
4 | 4 |
|
5 | 5 | import Builtin
|
6 | 6 | import Swift
|
7 | 7 | import SwiftShims
|
| 8 | +import c_layout |
| 9 | + |
8 | 10 |
|
9 | 11 | struct X {
|
10 | 12 | @sil_stored var i: Int64 { get set }
|
@@ -1266,6 +1268,44 @@ bb5:
|
1266 | 1268 | return %16 : $()
|
1267 | 1269 | }
|
1268 | 1270 |
|
| 1271 | +class RefElemClass { |
| 1272 | + var x : BitfieldOne |
| 1273 | + var y : Int32 |
| 1274 | + init() |
| 1275 | +} |
| 1276 | + |
| 1277 | +// CHECK-LABEL: sil @ref_elem_c : $@convention(thin) (RefElemClass) -> () { |
| 1278 | +// CHECK: [[GLOBAL:%.*]] = global_addr @globalX : $*X |
| 1279 | +// CHECK-NEXT: [[BEGIN:%.*]] = begin_access [read] [dynamic] [no_nested_conflict] [[GLOBAL]] : $*X |
| 1280 | +// CHECK-NEXT: load [[BEGIN]] : $*X |
| 1281 | +// CHECK-NEXT: end_access [[BEGIN]] : $*X |
| 1282 | +// CHECK-NEXT: [[REFX:%.*]] = ref_element_addr %0 : $RefElemClass, #RefElemClass.x |
| 1283 | +// CHECK-NEXT: [[REFY:%.*]] = ref_element_addr %0 : $RefElemClass, #RefElemClass.y |
| 1284 | +// CHECK-NEXT: [[BEGINX:%.*]] = begin_access [modify] [dynamic] [[REFX]] : $*BitfieldOne |
| 1285 | +// CHECK: [[BEGINY:%.*]] = begin_access [modify] [dynamic] [no_nested_conflict] [[REFY]] : $*Int32 |
| 1286 | +// CHECK-NEXT: end_access [[BEGINX]] : $*BitfieldOne |
| 1287 | +// CHECK-NEXT: end_access [[BEGINY]] : $*Int32 |
| 1288 | +// CHECK-LABEL: } // end sil function 'ref_elem_c' |
| 1289 | + |
| 1290 | +sil @ref_elem_c : $@convention(thin) (RefElemClass) -> () { |
| 1291 | +bb0(%0 : $RefElemClass): |
| 1292 | + %b0 = global_addr @globalX: $*X |
| 1293 | + %1 = begin_access [read] [dynamic] %b0 : $*X |
| 1294 | + %2 = load %1 : $*X |
| 1295 | + end_access %1 : $*X |
| 1296 | + %x = ref_element_addr %0 : $RefElemClass, #RefElemClass.x |
| 1297 | + %y = ref_element_addr %0 : $RefElemClass, #RefElemClass.y |
| 1298 | + %b1 = begin_access [modify] [dynamic] %x : $*BitfieldOne |
| 1299 | + %u0 = function_ref @globalAddressor : $@convention(thin) () -> Builtin.RawPointer |
| 1300 | + %u1 = apply %u0() : $@convention(thin) () -> Builtin.RawPointer |
| 1301 | + end_access %b1 : $*BitfieldOne |
| 1302 | + %b2 = begin_access [modify] [dynamic] %y : $*Int32 |
| 1303 | + %b3 = begin_access [modify] [dynamic] %x : $*BitfieldOne |
| 1304 | + end_access %b3 : $*BitfieldOne |
| 1305 | + end_access %b2 : $*Int32 |
| 1306 | + %10 = tuple () |
| 1307 | + return %10 : $() |
| 1308 | +} |
1269 | 1309 |
|
1270 | 1310 | // public func testStronglyConnectedComponent() {
|
1271 | 1311 | // During the merge optimization,
|
|
0 commit comments