blob: 2d83559382486f854835b534349b044c96aa7396 [file] [log] [blame]
// RUN: %target-sil-opt -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>, {{.*}} line:40:9:minlined
// 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
}