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
|
// First parse this and then emit a *.sib. Then read in the *.sib, then recreate
// RUN: %empty-directory(%t)
// RUN: %target-sil-opt %s -emit-sib -o %t/tmp.sib -module-name copydestroy_value
// RUN: %target-sil-opt %t/tmp.sib -o %t/tmp.2.sib -module-name copydestroy_value
// RUN: %target-sil-opt %t/tmp.2.sib -module-name copydestroy_value -emit-sorted-sil | %FileCheck %s
sil_stage canonical
import Builtin
// CHECK-LABEL: sil [serialized] [ossa] @test_copy_value : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
// CHECK: bb0([[ARG1:%[0-9]+]] : @owned $Builtin.NativeObject):
// CHECK: [[COPY_VALUE_RESULT:%[0-9]+]] = copy_value [[ARG1]] : $Builtin.NativeObject
// CHECK: destroy_value [[ARG1]]
// CHECK: return [[COPY_VALUE_RESULT]]
sil [serialized] [ossa] @test_copy_value : $@convention(thin) (@owned Builtin.NativeObject) -> @owned Builtin.NativeObject {
bb0(%0 : @owned $Builtin.NativeObject):
%1 = copy_value %0 : $Builtin.NativeObject
destroy_value %0 : $Builtin.NativeObject
return %1 : $Builtin.NativeObject
}
// CHECK-LABEL: sil [serialized] [ossa] @test_poison
// CHECK: bb0(%0 : @owned $Builtin.NativeObject):
// CHECK-NEXT: destroy_value [poison] %0 : $Builtin.NativeObject
// CHECK-NEXT: tuple
// CHECK-NEXT: return
sil [serialized] [ossa] @test_poison : $@convention(thin) (@owned Builtin.NativeObject) -> () {
bb0(%0 : @owned $Builtin.NativeObject):
destroy_value [poison] %0 : $Builtin.NativeObject
%2 = tuple ()
return %2 : $()
}
// CHECK-LABEL: sil [serialized] [ossa] @test_strong_copy_unowned_value : $@convention(thin) (@owned @sil_unowned Builtin.NativeObject) -> @owned Builtin.NativeObject {
// CHECK: bb0([[T0:%[0-9]+]] : @owned $@sil_unowned Builtin.NativeObject):
// CHECK-NEXT: [[COPY_RESULT:%.*]] = strong_copy_unowned_value [[T0]] : $@sil_unowned Builtin.NativeObject
// CHECK-NEXT: destroy_value [[T0]] : $@sil_unowned Builtin.NativeObject
// CHECK-NEXT: return [[COPY_RESULT]] : $Builtin.NativeObject
sil [serialized] [ossa] @test_strong_copy_unowned_value : $@convention(thin) (@owned @sil_unowned Builtin.NativeObject) -> @owned Builtin.NativeObject {
bb0(%0 : @owned $@sil_unowned Builtin.NativeObject):
%1 = strong_copy_unowned_value %0 : $@sil_unowned Builtin.NativeObject
destroy_value %0 : $@sil_unowned Builtin.NativeObject
return %1 : $Builtin.NativeObject
}
|