mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When the IRGen side is implemented, this will overwrite shadow debug variables with a poison sentinel for all references within the value.
47 lines
2.3 KiB
Plaintext
47 lines
2.3 KiB
Plaintext
// 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
|
|
}
|
|
|