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.
67 lines
3.8 KiB
Plaintext
67 lines
3.8 KiB
Plaintext
// RUN: %target-sil-opt -sil-print-types -sil-print-debuginfo -enable-sil-verify-all -mandatory-inlining -emit-verbose-sil %s | %FileCheck %s
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
sil @plus : $@convention(thin) (Int64, Int64) -> Int64
|
|
sil @fromLiteral : $@convention(thin) (Builtin.Int128, @thin Int64.Type) -> Int64
|
|
|
|
// CHECK-LABEL: sil [transparent] @test_add : $@convention(thin) (Int64) -> Int64 {
|
|
sil [transparent] @test_add : $@convention(thin) (Int64) -> Int64 {
|
|
bb0(%0 : $Int64):
|
|
%1 = alloc_box $<τ_0_0> { var τ_0_0 } <Int64>
|
|
%1a = project_box %1 : $<τ_0_0> { var τ_0_0 } <Int64>, 0
|
|
store %0 to %1a : $*Int64
|
|
%3 = function_ref @plus : $@convention(thin) (Int64, Int64) -> Int64
|
|
%4 = load %1a : $*Int64
|
|
%5 = function_ref @fromLiteral : $@convention(thin) (Builtin.Int128, @thin Int64.Type) -> Int64
|
|
%6 = metatype $@thin Int64.Type
|
|
%7 = integer_literal $Builtin.Int128, 20
|
|
%8 = apply %5(%7, %6) : $@convention(thin) (Builtin.Int128, @thin Int64.Type) -> Int64
|
|
%9 = apply %3(%4, %8) : $@convention(thin) (Int64, Int64) -> Int64
|
|
strong_release %1 : $<τ_0_0> { var τ_0_0 } <Int64>
|
|
return %9 : $Int64
|
|
}
|
|
|
|
sil @inline_test_add : $@convention(thin) (Int64) -> Int64 {
|
|
bb0(%0 : $Int64):
|
|
%1 = alloc_box $<τ_0_0> { var τ_0_0 } <Int64>
|
|
%1a = project_box %1 : $<τ_0_0> { var τ_0_0 } <Int64>, 0
|
|
store %0 to %1a : $*Int64
|
|
%3 = function_ref @plus : $@convention(thin) (Int64, Int64) -> Int64
|
|
%4 = function_ref @test_add : $@convention(thin) (Int64) -> Int64
|
|
%5 = function_ref @plus : $@convention(thin) (Int64, Int64) -> Int64
|
|
%6 = load %1a : $*Int64
|
|
%7 = function_ref @fromLiteral : $@convention(thin) (Builtin.Int128, @thin Int64.Type) -> Int64
|
|
%8 = metatype $@thin Int64.Type
|
|
%9 = integer_literal $Builtin.Int128, 10
|
|
%10 = apply %7(%9, %8) : $@convention(thin) (Builtin.Int128, @thin Int64.Type) -> Int64
|
|
%11 = apply %5(%6, %10) : $@convention(thin) (Int64, Int64) -> Int64
|
|
%12 = apply %4(%11) : $@convention(thin) (Int64) -> Int64
|
|
%13 = function_ref @fromLiteral : $@convention(thin) (Builtin.Int128, @thin Int64.Type) -> Int64
|
|
%14 = metatype $@thin Int64.Type
|
|
%15 = integer_literal $Builtin.Int128, 30
|
|
%16 = apply %13(%15, %14) : $@convention(thin) (Builtin.Int128, @thin Int64.Type) -> Int64
|
|
%17 = apply %3(%12, %16) : $@convention(thin) (Int64, Int64) -> Int64
|
|
strong_release %1 : $<τ_0_0> { var τ_0_0 } <Int64>
|
|
return %17 : $Int64
|
|
|
|
// CHECK-LABEL: sil @inline_test_add : $@convention(thin) (Int64) -> Int64 {
|
|
// CHECK: [[VAL9:%.*]] = apply {{.*}} line:38:9:sil
|
|
// CHECK: [[VAL10:%.*]] = apply {{.*}} line:39:9:sil
|
|
// CHECK: [[VAL11:%.*]] = alloc_box $<τ_0_0> { var τ_0_0 } <Int64>, {{.*}}compiler-generated
|
|
// CHECK: [[PB11:%.*]] = project_box [[VAL11]] {{.*}} line:40:9:minlined
|
|
// CHECK: store [[VAL10]] to [[PB11]] {{.*}} line:40:9:minlined
|
|
// CHECK: [[VAL13:%.*]] = function_ref @plus {{.*}} line:40:9:minlined
|
|
// CHECK: [[VAL14:%.*]] = load [[PB11]] {{.*}} line:40:9:minlined
|
|
// CHECK: [[VAL15:%.*]] = function_ref @fromLiteral {{.*}} line:40:9:minlined
|
|
// CHECK: [[VAL16:%.*]] = metatype $@thin Int64.Type, {{.*}} line:40:9:minlined
|
|
// CHECK: [[VAL17:%.*]] = integer_literal $Builtin.Int128, 20, {{.*}} line:40:9:minlined
|
|
// CHECK: [[VAL18:%.*]] = apply [[VAL15]]([[VAL17]], [[VAL16]]) {{.*}} line:40:9:minlined
|
|
// CHECK: [[VAL19:%.*]] = apply [[VAL13]]([[VAL14]], [[VAL18]]) {{.*}} line:40:9:minlined
|
|
// CHECK: strong_release [[VAL11]] {{.*}} line:40:9:minlined
|
|
// CHECK: [[VAL21:%.*]] = function_ref @fromLiteral {{.*}} line:41:9
|
|
// CHECK: [[VAL22:%.*]] = metatype $@thin Int64.Type, {{.*}} line:42:9
|
|
// CHECK: [[VAL23:%.*]] = integer_literal $Builtin.Int128, 30, {{.*}} line:43:9
|
|
}
|