mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Type annotations for instruction operands are omitted, e.g. ``` %3 = struct $S(%1, %2) ``` Operand types are redundant anyway and were only used for sanity checking in the SIL parser. But: operand types _are_ printed if the definition of the operand value was not printed yet. This happens: * if the block with the definition appears after the block where the operand's instruction is located * if a block or instruction is printed in isolation, e.g. in a debugger The old behavior can be restored with `-Xllvm -sil-print-types`. This option is added to many existing test files which check for operand types in their check-lines.
71 lines
2.4 KiB
Swift
71 lines
2.4 KiB
Swift
// RUN: %target-swift-emit-silgen -Xllvm -sil-print-types -disable-experimental-parser-round-trip -disable-availability-checking -enable-experimental-feature ValueGenerics -enable-experimental-feature BuiltinModule %s | %FileCheck %s
|
|
|
|
// REQUIRES: swift_feature_BuiltinModule
|
|
// REQUIRES: swift_feature_ValueGenerics
|
|
|
|
import Builtin
|
|
|
|
struct MyVector<let N: Int, T: ~Copyable>: ~Copyable {
|
|
var storage: Builtin.FixedArray<N, T>
|
|
}
|
|
extension MyVector: Copyable where T: Copyable {}
|
|
|
|
// CHECK-LABEL: sil{{.*}} @$s{{.*}}13trivial_fixed
|
|
// CHECK: bb0(%0 : $MyVector<4, Int>):
|
|
// CHECK: tuple (%0 : {{.*}}, %0 : {{.*}})
|
|
func trivial_fixed(a: MyVector<4, Int>) -> (MyVector<4, Int>, MyVector<4, Int>){
|
|
return (a, a)
|
|
}
|
|
|
|
// CHECK-LABEL: sil{{.*}} @$s{{.*}}14loadable_fixed
|
|
// CHECK: bb0(%0 : @guaranteed $MyVector<4, AnyObject>):
|
|
// CHECK: [[COPY1:%.*]] = copy_value %0
|
|
// CHECK: [[COPY2:%.*]] = copy_value %0
|
|
// CHECK: tuple ([[COPY1]] : {{.*}}, [[COPY2]] : {{.*}})
|
|
func loadable_fixed(a: MyVector<4, AnyObject>)
|
|
-> (MyVector<4, AnyObject>, MyVector<4, AnyObject>)
|
|
{
|
|
return (a, a)
|
|
}
|
|
|
|
// CHECK-LABEL: sil{{.*}} @$s{{.*}}8ao_fixed
|
|
// CHECK: bb0(%0 : $*MyVector<4, Any>, %1 : $*MyVector<4, Any>, %2 : $*MyVector<4, Any>):
|
|
// CHECK: copy_addr %2 to [init] %0
|
|
// CHECK: copy_addr %2 to [init] %1
|
|
func ao_fixed(a: MyVector<4, Any>)
|
|
-> (MyVector<4, Any>, MyVector<4, Any>)
|
|
{
|
|
return (a, a)
|
|
}
|
|
|
|
// CHECK-LABEL: sil{{.*}} @$s{{.*}}11trivial_dep
|
|
// CHECK: bb0(%0 : $*MyVector<N, Int>, %1 : $*MyVector<N, Int>, %2 : $*MyVector<N, Int>):
|
|
// CHECK: copy_addr %2 to [init] %0
|
|
// CHECK: copy_addr %2 to [init] %1
|
|
func trivial_dep<let N: Int>(a: MyVector<N, Int>)
|
|
-> (MyVector<N, Int>, MyVector<N, Int>)
|
|
{
|
|
return (a, a)
|
|
}
|
|
|
|
// CHECK-LABEL: sil{{.*}} @$s{{.*}}12loadable_dep
|
|
// CHECK: bb0(%0 : $*MyVector<N, AnyObject>, %1 : $*MyVector<N, AnyObject>, %2 : $*MyVector<N, AnyObject>):
|
|
// CHECK: copy_addr %2 to [init] %0
|
|
// CHECK: copy_addr %2 to [init] %1
|
|
func loadable_dep<let N: Int>(a: MyVector<N, AnyObject>)
|
|
-> (MyVector<N, AnyObject>, MyVector<N, AnyObject>)
|
|
{
|
|
return (a, a)
|
|
}
|
|
|
|
// CHECK-LABEL: sil{{.*}} @$s{{.*}}6ao_dep
|
|
// CHECK: bb0(%0 : $*MyVector<N, Any>, %1 : $*MyVector<N, Any>, %2 : $*MyVector<N, Any>):
|
|
// CHECK: copy_addr %2 to [init] %0
|
|
// CHECK: copy_addr %2 to [init] %1
|
|
func ao_dep<let N: Int>(a: MyVector<N, Any>)
|
|
-> (MyVector<N, Any>, MyVector<N, Any>)
|
|
{
|
|
return (a, a)
|
|
}
|
|
|