| 
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  | 
@@ -62,6 +63,11 @@ struct NEWrap : ~Escapable {  | 
62 | 63 |   init() { }  | 
63 | 64 | }  | 
64 | 65 | 
 
  | 
 | 66 | +@_addressableForDependencies  | 
 | 67 | +public struct InlineInt {  | 
 | 68 | +  var i: Builtin.Int64  | 
 | 69 | +}  | 
 | 70 | + | 
65 | 71 | sil @coroutine : $@yield_once @convention(method) (@guaranteed NE) -> @yields @guaranteed NE  | 
66 | 72 | 
 
  | 
67 | 73 | sil @capture : $@convention(thin) (@guaranteed NE) -> ()  | 
@@ -347,3 +353,26 @@ bb0(%0 : @owned $NCNEInt):  | 
347 | 353 |   %99 = tuple()  | 
348 | 354 |   return %99 : $()  | 
349 | 355 | }  | 
 | 356 | + | 
 | 357 | +// =============================================================================  | 
 | 358 | +// isAddressable  | 
 | 359 | +// =============================================================================  | 
 | 360 | + | 
 | 361 | +sil [ossa] @addressableForInoutDepHelper : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> () {  | 
 | 362 | +bb(%0 : $*InlineInt, %1 : $*NE):  | 
 | 363 | +  %99 = tuple()  | 
 | 364 | +  return %99 : $()  | 
 | 365 | +}  | 
 | 366 | + | 
 | 367 | +// CHECK-LABEL: begin running test 1 of 1 on addressableForInoutDep: addressable_arguments with: @instruction.operand[1]  | 
 | 368 | +// CHECK: Arg Index: 0 of Apply:   %{{.*}} = apply %{{.*}}(%0, %1) : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> ()  | 
 | 369 | +// CHECK: isAddressable: true  | 
 | 370 | +// CHECK-LABEL: end running test 1 of 1 on addressableForInoutDep: addressable_arguments with: @instruction.operand[1]  | 
 | 371 | +sil [ossa] @addressableForInoutDep : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> () {  | 
 | 372 | +bb(%0 : $*InlineInt, %1 : $*NE):  | 
 | 373 | +  %f = function_ref @addressableForInoutDepHelper : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> ()  | 
 | 374 | +  specify_test "addressable_arguments @instruction.operand[1]"  | 
 | 375 | +  %call = apply %f(%0, %1) : $@convention(thin) (@in_guaranteed InlineInt, @lifetime(borrow address_for_deps 0) @inout NE) -> ()  | 
 | 376 | +  %99 = tuple()  | 
 | 377 | +  return %99 : $()  | 
 | 378 | +}  | 
0 commit comments