|
1 | 1 | // RUN: %target-sil-opt -test-runner %s \ |
2 | 2 | // RUN: -module-name Swift \ |
3 | 3 | // RUN: -enable-experimental-feature LifetimeDependence \ |
| 4 | +// RUN: -enable-experimental-feature AddressableTypes \ |
4 | 5 | // RUN: -o /dev/null 2>&1 | %FileCheck %s |
5 | 6 |
|
6 | 7 | // REQUIRES: swift_in_compiler |
7 | 8 | // REQUIRES: swift_feature_LifetimeDependence |
| 9 | +// REQUIRES: swift_feature_AddressableTypes |
8 | 10 |
|
9 | 11 | sil_stage raw |
10 | 12 |
|
@@ -62,6 +64,11 @@ struct NEWrap : ~Escapable { |
62 | 64 | init() { } |
63 | 65 | } |
64 | 66 |
|
| 67 | +@_addressableForDependencies |
| 68 | +public struct InlineInt { |
| 69 | + var i: Builtin.Int64 |
| 70 | +} |
| 71 | + |
65 | 72 | sil @coroutine : $@yield_once @convention(method) (@guaranteed NE) -> @yields @guaranteed NE |
66 | 73 |
|
67 | 74 | sil @capture : $@convention(thin) (@guaranteed NE) -> () |
@@ -347,3 +354,26 @@ bb0(%0 : @owned $NCNEInt): |
347 | 354 | %99 = tuple() |
348 | 355 | return %99 : $() |
349 | 356 | } |
| 357 | + |
| 358 | +// ============================================================================= |
| 359 | +// isAddressable |
| 360 | +// ============================================================================= |
| 361 | + |
| 362 | +sil [ossa] @addressableForInoutDepHelper : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> () { |
| 363 | +bb(%0 : $*InlineInt, %1 : $*NE): |
| 364 | + %99 = tuple() |
| 365 | + return %99 : $() |
| 366 | +} |
| 367 | + |
| 368 | +// CHECK-LABEL: begin running test 1 of 1 on addressableForInoutDep: addressable_arguments with: @instruction.operand[1] |
| 369 | +// CHECK: Arg Index: 0 of Apply: %{{.*}} = apply %{{.*}}(%0, %1) : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> () |
| 370 | +// CHECK: isAddressable: true |
| 371 | +// CHECK-LABEL: end running test 1 of 1 on addressableForInoutDep: addressable_arguments with: @instruction.operand[1] |
| 372 | +sil [ossa] @addressableForInoutDep : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> () { |
| 373 | +bb(%0 : $*InlineInt, %1 : $*NE): |
| 374 | + %f = function_ref @addressableForInoutDepHelper : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> () |
| 375 | + specify_test "addressable_arguments @instruction.operand[1]" |
| 376 | + %call = apply %f(%0, %1) : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> () |
| 377 | + %99 = tuple() |
| 378 | + return %99 : $() |
| 379 | +} |
0 commit comments