Skip to content

Commit e6ca03d

Browse files
committed
Generalize constant_propagation_stdlib SIL tests
1 parent ff7542a commit e6ca03d

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

test/SILOptimizer/constant_propagation_stdlib.swift

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public struct MyInt {
77

88
// CHECK-ONONE-LABEL: sil @$s27constant_propagation_stdlib15isConcrete_trueyBi1_AA5MyIntVF : $@convention(thin) (MyInt) -> Builtin.Int1 {
99
// CHECK-ONONE: bb0(
10-
// CHECK-ONONE: debug_value %0 : $MyInt, let, name "x", argno 1
1110
// CHECK-ONONE: [[RESULT:%.*]] = integer_literal $Builtin.Int1, -1
1211
// CHECK-ONONE: return [[RESULT]]
1312
// CHECK-ONONE: } // end sil function '$s27constant_propagation_stdlib15isConcrete_trueyBi1_AA5MyIntVF'
@@ -22,7 +21,6 @@ public func isConcrete_true(_ x: MyInt) -> Builtin.Int1 {
2221

2322
// CHECK-ONONE-LABEL: sil @$s27constant_propagation_stdlib16isConcrete_falseyBi1_xlF : $@convention(thin) <T> (@in_guaranteed T) -> Builtin.Int1 {
2423
// CHECK-ONONE: bb0(
25-
// CHECK-ONONE: debug_value_addr %0 : $*T, let, name "x", argno 1
2624
// CHECK-ONONE: [[METATYPE:%.*]] = metatype $@thick T.Type
2725
// CHECK-ONONE: [[RESULT:%.*]] = builtin "isConcrete"<T>([[METATYPE]] : $@thick T.Type) : $Builtin.Int1
2826
// CHECK-ONONE: return [[RESULT]]
@@ -39,9 +37,8 @@ public func isConcrete_false<T>(_ x: T) -> Builtin.Int1 {
3937

4038
// CHECK-ONONE-LABEL: sil @$s27constant_propagation_stdlib25isConcrete_generic_calleryBi1_xlF : $@convention(thin) <T> (@in_guaranteed T) -> Builtin.Int1 {
4139
// CHECK-ONONE: bb0(
42-
// CHECK-ONONE: debug_value_addr %0 : $*T, let, name "x", argno 1
43-
// CHECK-ONONE: %2 = function_ref @$s27constant_propagation_stdlib16isConcrete_falseyBi1_xlF : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
44-
// CHECK-ONONE: [[RESULT:%.*]] = apply %2<T>(%0) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
40+
// CHECK-ONONE: [[GEN_FUNC:%.*]] = function_ref @$s27constant_propagation_stdlib16isConcrete_falseyBi1_xlF : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
41+
// CHECK-ONONE: [[RESULT:%.*]] = apply [[GEN_FUNC]]<T>(%0) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
4542
// CHECK-ONONE: return [[RESULT]]
4643
// CHECK-ONONE: } // end sil function '$s27constant_propagation_stdlib25isConcrete_generic_calleryBi1_xlF'
4744
// CHECK-O-LABEL: sil @$s27constant_propagation_stdlib25isConcrete_generic_calleryBi1_xlF : $@convention(thin) <T> (@in_guaranteed T) -> Builtin.Int1 {
@@ -56,12 +53,11 @@ public func isConcrete_generic_caller<T>(_ x: T) -> Builtin.Int1 {
5653

5754
// CHECK-ONONE-LABEL: sil @$s27constant_propagation_stdlib26isConcrete_concrete_calleryBi1_AA5MyIntVF : $@convention(thin) (MyInt) -> Builtin.Int1 {
5855
// CHECK-ONONE: bb0(
59-
// CHECK-ONONE: debug_value %0 : $MyInt, let, name "x", argno 1
60-
// CHECK-ONONE: %2 = alloc_stack $MyInt
61-
// CHECK-ONONE: store %0 to %2 : $*MyInt
62-
// CHECK-ONONE: %4 = function_ref @$s27constant_propagation_stdlib25isConcrete_generic_calleryBi1_xlF : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
63-
// CHECK-ONONE: [[RESULT:%.*]] = apply %4<MyInt>(%2) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
64-
// CHECK-ONONE: dealloc_stack %2 : $*MyInt
56+
// CHECK-ONONE: [[STACK_ARG:%.*]] = alloc_stack $MyInt
57+
// CHECK-ONONE: store %0 to [[STACK_ARG]] : $*MyInt
58+
// CHECK-ONONE: [[GEN_FUNC:%.*]] = function_ref @$s27constant_propagation_stdlib25isConcrete_generic_calleryBi1_xlF : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
59+
// CHECK-ONONE: [[RESULT:%.*]] = apply [[GEN_FUNC]]<MyInt>([[STACK_ARG]]) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
60+
// CHECK-ONONE: dealloc_stack [[STACK_ARG]] : $*MyInt
6561
// CHECK-ONONE: return [[RESULT]]
6662
// CHECK-ONONE: } // end sil function '$s27constant_propagation_stdlib26isConcrete_concrete_calleryBi1_AA5MyIntVF'
6763
// CHECK-O-LABEL: sil @$s27constant_propagation_stdlib26isConcrete_concrete_calleryBi1_AA5MyIntVF : $@convention(thin) (MyInt) -> Builtin.Int1 {
@@ -75,17 +71,16 @@ public func isConcrete_concrete_caller(_ x: MyInt) -> Builtin.Int1 {
7571

7672
// CHECK-ONONE-LABEL: sil @$s27constant_propagation_stdlib4main1xBi1__Bi1_Bi1_tAA5MyIntV_tF : $@convention(thin) (MyInt) -> (Builtin.Int1, Builtin.Int1, Builtin.Int1) {
7773
// CHECK-ONONE: bb0(
78-
// CHECK-ONONE: debug_value %0 : $MyInt, let, name "x", argno 1
79-
// CHECK-ONONE: %2 = function_ref @$s27constant_propagation_stdlib15isConcrete_trueyBi1_AA5MyIntVF : $@convention(thin) (MyInt) -> Builtin.Int1
80-
// CHECK-ONONE: %3 = apply %2(%0) : $@convention(thin) (MyInt) -> Builtin.Int1
81-
// CHECK-ONONE: %4 = alloc_stack $MyInt
82-
// CHECK-ONONE: store %0 to %4 : $*MyInt
83-
// CHECK-ONONE: %6 = function_ref @$s27constant_propagation_stdlib16isConcrete_falseyBi1_xlF : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
84-
// CHECK-ONONE: %7 = apply %6<MyInt>(%4) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
85-
// CHECK-ONONE: dealloc_stack %4 : $*MyInt
86-
// CHECK-ONONE: %9 = function_ref @$s27constant_propagation_stdlib26isConcrete_concrete_calleryBi1_AA5MyIntVF : $@convention(thin) (MyInt) -> Builtin.Int1
87-
// CHECK-ONONE: %10 = apply %9(%0) : $@convention(thin) (MyInt) -> Builtin.Int1
88-
// CHECK-ONONE: [[RESULT:%.*]] = tuple (%3 : $Builtin.Int1, %7 : $Builtin.Int1, %10 : $Builtin.Int1)
74+
// CHECK-ONONE: [[IS_CONCRETE_TRUE_FUNC:%.*]] = function_ref @$s27constant_propagation_stdlib15isConcrete_trueyBi1_AA5MyIntVF : $@convention(thin) (MyInt) -> Builtin.Int1
75+
// CHECK-ONONE: [[IS_CONCRETE_TRUE:%.*]] = apply [[IS_CONCRETE_TRUE_FUNC]](%0) : $@convention(thin) (MyInt) -> Builtin.Int1
76+
// CHECK-ONONE: [[STACK_ARG:%.*]] = alloc_stack $MyInt
77+
// CHECK-ONONE: store %0 to [[STACK_ARG]] : $*MyInt
78+
// CHECK-ONONE: [[IS_CONCRETE_FALSE_FUNC:%.*]] = function_ref @$s27constant_propagation_stdlib16isConcrete_falseyBi1_xlF : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
79+
// CHECK-ONONE: [[IS_CONCRETE_FALSE:%.*]] = apply [[IS_CONCRETE_FALSE_FUNC]]<MyInt>([[STACK_ARG]]) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> Builtin.Int1
80+
// CHECK-ONONE: dealloc_stack [[STACK_ARG]] : $*MyInt
81+
// CHECK-ONONE: [[IS_CONCRETE_CONCRETE_CALLER_FUNC:%.*]] = function_ref @$s27constant_propagation_stdlib26isConcrete_concrete_calleryBi1_AA5MyIntVF : $@convention(thin) (MyInt) -> Builtin.Int1
82+
// CHECK-ONONE: [[IS_CONCRETE_CONCRETE_CALLER:%.*]] = apply [[IS_CONCRETE_CONCRETE_CALLER_FUNC]](%0) : $@convention(thin) (MyInt) -> Builtin.Int1
83+
// CHECK-ONONE: [[RESULT:%.*]] = tuple ([[IS_CONCRETE_TRUE]] : $Builtin.Int1, [[IS_CONCRETE_FALSE]] : $Builtin.Int1, [[IS_CONCRETE_CONCRETE_CALLER]] : $Builtin.Int1)
8984
// CHECK-ONONE: return [[RESULT]]
9085
// CHECK-ONONE: } // end sil function '$s27constant_propagation_stdlib4main1xBi1__Bi1_Bi1_tAA5MyIntV_tF'
9186
// CHECK-O-LABEL: sil @$s27constant_propagation_stdlib4main1xBi1__Bi1_Bi1_tAA5MyIntV_tF : $@convention(thin) (MyInt) -> (Builtin.Int1, Builtin.Int1, Builtin.Int1) {

0 commit comments

Comments
 (0)