1- // RUN: %target-sil-opt -enable-sil-verify-all %s -array-property-opt
1+ // RUN: %target-sil-opt -enable-sil-verify-all %s -array-property-opt | %FileCheck %s
22
33sil_stage canonical
44
@@ -21,6 +21,18 @@ enum MyBool{
2121class MyClass {
2222}
2323
24+ // CHECK-LABEL: sil @clone_switch_enum_exit :
25+ // CHECK: bb1:
26+ // CHECK: [[FUNC1:%.*]] = function_ref @arrayPropertyIsNative
27+ // CHECK: apply [[FUNC1]]
28+ // CHECK: cond_br {{.*}}, bb11, bb2
29+ // CHECK: bb2:
30+ // CHECK: br bb3
31+ // CHECK: bb3:
32+ // CHECK: [[FUNC2:%.*]] = function_ref @arrayPropertyIsNative
33+ // CHECK: apply [[FUNC2]]
34+ // CHECK_LABEL: } // end sil function 'clone_switch_enum_exit'
35+
2436/// We need to split the loop exit edge from bb1 to bb3 before updating ssa form
2537/// after cloning.
2638sil @clone_switch_enum_exit : $@convention(thin) (@inout MyArray<MyClass>, @inout MyBool) -> MyBool {
5567protocol AProtocol : class {
5668}
5769
70+ // CHECK-LABEL: sil @cant_handle_open_existential_use_outside_loop :
71+ // CHECK: bb1:
72+ // CHECK: [[FUNC1:%.*]] = function_ref @arrayPropertyIsNative
73+ // CHECK: apply [[FUNC1]]
74+ // CHECK-NOT: [[FUNC2:%.*]] = function_ref @arrayPropertyIsNative
75+ // CHECK-NOT: apply [[FUNC2]]
76+ // CHECK-LABEL: } // end sil function 'cant_handle_open_existential_use_outside_loop'
5877sil @cant_handle_open_existential_use_outside_loop : $@convention(thin) (@inout MyArray<MyClass>, @inout MyBool, @owned AProtocol) -> MyBool {
5978bb0(%0 : $*MyArray<MyClass>, %1 : $*MyBool, %10 : $AProtocol):
6079 %3 = load %0 : $*MyArray<MyClass>
@@ -95,6 +114,17 @@ bb0(%0: $MyArray<MyClass>):
95114
96115sil @throwing_fun : $@convention(thin) () -> (MyBool, @error Error)
97116
117+ // CHECK-LABEL: sil @clone_try_apply_exit :
118+ // CHECK: bb1:
119+ // CHECK: [[FUNC1:%.*]] = function_ref @arrayPropertyIsNative
120+ // CHECK: apply [[FUNC1]]
121+ // CHECK: cond_br {{.*}}, bb10, bb2
122+ // CHECK: bb2:
123+ // CHECK: br bb3
124+ // CHECK: bb3:
125+ // CHECK: [[FUNC2:%.*]] = function_ref @arrayPropertyIsNative
126+ // CHECK: apply [[FUNC2]]
127+ // CHECK_LABEL: } // end sil function 'clone_try_apply_exit'
98128sil @clone_try_apply_exit : $@convention(thin) (@inout MyArray<MyClass>, @inout MyBool) -> (MyBool, @error Error) {
99129bb0(%0 : $*MyArray<MyClass>, %1 : $*MyBool):
100130 %3 = load %0 : $*MyArray<MyClass>
@@ -122,6 +152,17 @@ bb6(%9 : $Error):
122152 throw %9 : $Error
123153}
124154
155+ // CHECK-LABEL: sil @dominator_update_outside_non_exit_block :
156+ // CHECK: bb1:
157+ // CHECK: [[FUNC1:%.*]] = function_ref @arrayPropertyIsNative
158+ // CHECK: apply [[FUNC1]]
159+ // CHECK: cond_br {{.*}}, bb16, bb2
160+ // CHECK: bb2:
161+ // CHECK: br bb3
162+ // CHECK: bb3:
163+ // CHECK: [[FUNC2:%.*]] = function_ref @arrayPropertyIsNative
164+ // CHECK: apply [[FUNC2]]
165+ // CHECK_LABEL: } // end sil function 'dominator_update_outside_non_exit_block'
125166sil @dominator_update_outside_non_exit_block : $@convention(thin) (@inout MyArray<MyClass>, @inout Builtin.Int1) -> Builtin.Int1 {
126167bb0(%0 : $*MyArray<MyClass>, %1 : $*Builtin.Int1):
127168 %3 = load %0 : $*MyArray<MyClass>
@@ -163,6 +204,17 @@ bb10:
163204 return %4 : $Builtin.Int1
164205}
165206
207+ // CHECK-LABEL: sil @dominator_update_outside_non_exit_block_2 :
208+ // CHECK: bb1:
209+ // CHECK: [[FUNC1:%.*]] = function_ref @arrayPropertyIsNative
210+ // CHECK: apply [[FUNC1]]
211+ // CHECK: cond_br {{.*}}, bb17, bb2
212+ // CHECK: bb2:
213+ // CHECK: br bb3
214+ // CHECK: bb3:
215+ // CHECK: [[FUNC2:%.*]] = function_ref @arrayPropertyIsNative
216+ // CHECK: apply [[FUNC2]]
217+ // CHECK_LABEL: } // end sil function 'dominator_update_outside_non_exit_block_2'
166218sil @dominator_update_outside_non_exit_block_2 : $@convention(thin) (@inout MyArray<MyClass>, @inout Builtin.Int1) -> Builtin.Int1 {
167219bb0(%0 : $*MyArray<MyClass>, %1 : $*Builtin.Int1):
168220 %3 = load %0 : $*MyArray<MyClass>
0 commit comments