mirror of
https://github.com/apple/swift.git
synced 2026-10-24 20:15:56 +02:00
Just the $*T -> $*@moveOnly T variant for addresses. Unlike the object version this acts like a cast rather than something that provides semantics from the frontend to the optimizer.
79 lines
3.0 KiB
Plaintext
79 lines
3.0 KiB
Plaintext
// RUN: %target-sil-opt -verify %s
|
|
|
|
sil_stage raw
|
|
|
|
import Builtin
|
|
|
|
class Klass {}
|
|
|
|
struct S {
|
|
var k: Klass
|
|
}
|
|
|
|
sil [ossa] @moveonlywrapper_to_copyable_addr_test_1 : $@convention(thin) (@in Klass) -> () {
|
|
bb0(%0 : $*Klass):
|
|
%0a = moveonlywrapper_to_copyable_addr %0 : $*Klass
|
|
// expected-error @-1 {{operand of 'moveonlywrapper_to_copyable_addr' must be of moveonlywrapped type}}
|
|
destroy_addr %0a : $*Klass
|
|
%9999 = tuple()
|
|
}
|
|
|
|
sil [ossa] @moveonlywrapper_to_copyable_addr_test_2 : $@convention(thin) (@owned Klass) -> () {
|
|
bb0(%1 : @owned $Klass):
|
|
%2 = moveonlywrapper_to_copyable_addr %1 : $Klass
|
|
// expected-error @-1 {{operand of 'moveonlywrapper_to_copyable_addr' must have address type}}
|
|
destroy_value %2 : $Klass
|
|
%9999 = tuple()
|
|
}
|
|
|
|
sil [ossa] @moveonlywrapper_to_copyable_value_test_1 : $@convention(thin) (@in Klass, @owned Klass) -> () {
|
|
bb0(%0 : $*Klass, %1 : @owned $Klass):
|
|
%2 = moveonlywrapper_to_copyable [guaranteed] %0 : $*Klass
|
|
// expected-error @-1 {{operand of 'moveonlywrapper_to_copyable' must have object type}}
|
|
destroy_addr %2 : $*Klass
|
|
%3 = moveonlywrapper_to_copyable [guaranteed] %1 : $Klass
|
|
destroy_value %3 : $Klass
|
|
%9999 = tuple()
|
|
}
|
|
|
|
sil [ossa] @moveonlywrapper_to_copyable_value_test_2 : $@convention(thin) (@in Klass, @owned Klass) -> () {
|
|
bb0(%0 : $*Klass, %1 : @owned $Klass):
|
|
%3 = moveonlywrapper_to_copyable [guaranteed] %1 : $Klass
|
|
// expected-error @-1 {{operand of 'moveonlywrapper_to_copyable' must be of moveonlywrapped type}}
|
|
destroy_value %3 : $Klass
|
|
%9999 = tuple()
|
|
}
|
|
|
|
sil [ossa] @copyable_to_moveonlywrapper_value_test : $@convention(thin) (@in Klass, @owned @moveOnly Klass) -> () {
|
|
bb0(%0 : $*Klass, %1 : @owned $@moveOnly Klass):
|
|
%2 = copyable_to_moveonlywrapper [owned] %0 : $*Klass
|
|
// expected-error @-1 {{operand of 'copyable_to_moveonlywrapper' must have object type}}
|
|
destroy_addr %2 : $*Klass
|
|
%3 = copyable_to_moveonlywrapper [owned] %1 : $Klass
|
|
destroy_value %3 : $Klass
|
|
%9999 = tuple()
|
|
}
|
|
|
|
sil [ossa] @copyable_to_moveonlywrapper_value_test_2 : $@convention(thin) (@in Klass, @owned @moveOnly Klass) -> () {
|
|
bb0(%0 : $*Klass, %1 : @owned $@moveOnly Klass):
|
|
%3 = copyable_to_moveonlywrapper [owned] %1 : $@moveOnly Klass
|
|
// expected-error @-1 {{operand of 'copyable_to_moveonlywrapper' must not be of moveonlywrapped type}}
|
|
destroy_value %3 : $Klass
|
|
%9999 = tuple()
|
|
}
|
|
|
|
sil [ossa] @copyable_to_moveonlywrapper_addr_test_1 : $@convention(thin) (@in @moveOnly Klass) -> () {
|
|
bb0(%0 : $*@moveOnly Klass):
|
|
%0a = copyable_to_moveonlywrapper_addr %0 : $*@moveOnly Klass
|
|
// expected-error @-1 {{operand of 'copyable_to_moveonlywrapper_addr' must not be of moveonlywrapped type}}
|
|
destroy_addr %0a : $*@moveOnly Klass
|
|
%9999 = tuple()
|
|
}
|
|
|
|
sil [ossa] @copyable_to_moveonlywrapper_addr_test_2 : $@convention(thin) (@owned @moveOnly Klass) -> () {
|
|
bb0(%1 : @owned $@moveOnly Klass):
|
|
%2 = copyable_to_moveonlywrapper_addr %1 : $@moveOnly Klass
|
|
// expected-error @-1 {{operand of 'copyable_to_moveonlywrapper_addr' must have address type}}
|
|
destroy_value %2 : $@moveOnly Klass
|
|
%9999 = tuple()
|
|
} |