1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
// RUN: %target-sil-opt -compute-side-effects -test-runner %s 2>&1 | %FileCheck %s
// REQUIRES: swift_in_compiler
import Builtin
typealias Int32 = Builtin.Int32
sil_global public @my_errno : $Int32
sil_global shared @global_var : $Int32
sil [ossa] @unknown : $@convention(thin) () -> ()
sil [ossa] @unknown_caller : $@convention(thin) () -> () {
%unknown = function_ref @unknown : $@convention(thin) () -> ()
apply %unknown() : $@convention(thin) () -> ()
%retval = tuple ()
return %retval : $()
}
sil [ossa] @empty_fn : $@convention(thin) () -> () {
%retval = tuple ()
return %retval : $()
}
sil [ossa] @empty_fn_caller : $@convention(thin) () -> () {
%empty_fn = function_ref @empty_fn : $@convention(thin) () -> ()
apply %empty_fn() : $@convention(thin) () -> ()
%retval = tuple ()
return %retval : $()
}
sil [ossa] @empty_fn_caller_caller : $@convention(thin) () -> () {
%empty_fn_caller = function_ref @empty_fn_caller : $@convention(thin) () -> ()
apply %empty_fn_caller() : $@convention(thin) () -> ()
%retval = tuple ()
return %retval : $()
}
// CHECK-LABEL: begin running test 1 of {{[0-9]+}} on call_functions: dump-function
// CHECK: [[EMPTY_FN:%[^,]+]] = function_ref @empty_fn
// CHECK: [[EMPTY_FN_CALLER:%[^,]+]] = function_ref @empty_fn_caller
// CHECK: [[EMPTY_FN_CALLER_CALLER:%[^,]+]] = function_ref @empty_fn_caller_caller
// CHECK: [[UNKNOWN:%[^,]+]] = function_ref @unknown
// CHECK: [[UNKNOWN_CALLER:%[^,]+]] = function_ref @unknown_caller
// CHECK-LABEL: end running test 1 of {{[0-9]+}} on call_functions: dump-function
// CHECK-LABEL: begin running test 2 of {{[0-9]+}} on call_functions: is-deinit-barrier
// CHECK: apply [[EMPTY_FN]]
// CHECK: false
// CHECK-LABEL: end running test 2 of {{[0-9]+}} on call_functions: is-deinit-barrier
// CHECK-LABEL: begin running test 3 of {{[0-9]+}} on call_functions: is-deinit-barrier
// CHECK: apply [[EMPTY_FN_CALLER]]
// CHECK: false
// CHECK-LABEL: end running test 3 of {{[0-9]+}} on call_functions: is-deinit-barrier
// CHECK-LABEL: begin running test 4 of {{[0-9]+}} on call_functions: is-deinit-barrier
// CHECK: apply [[EMPTY_FN_CALLER_CALLER]]
// CHECK: false
// CHECK-LABEL: end running test 4 of {{[0-9]+}} on call_functions: is-deinit-barrier
// CHECK-LABEL: begin running test 5 of {{[0-9]+}} on call_functions: is-deinit-barrier
// CHECK: apply [[UNKNOWN]]
// CHECK: true
// CHECK-LABEL: end running test 5 of {{[0-9]+}} on call_functions: is-deinit-barrier
// CHECK-LABEL: begin running test 6 of {{[0-9]+}} on call_functions: is-deinit-barrier
// CHECK: apply [[UNKNOWN_CALLER]]
// CHECK: true
// CHECK-LABEL: end running test 6 of {{[0-9]+}} on call_functions: is-deinit-barrier
sil [ossa] @call_functions : $@convention(thin) () -> () {
entry:
specify_test "dump-function"
specify_test "is-deinit-barrier @instruction[1]"
%empty_fn = function_ref @empty_fn : $@convention(thin) () -> ()
apply %empty_fn() : $@convention(thin) () -> ()
specify_test "is-deinit-barrier @instruction[3]"
%empty_fn_caller = function_ref @empty_fn_caller : $@convention(thin) () -> ()
apply %empty_fn_caller() : $@convention(thin) () -> ()
specify_test "is-deinit-barrier @instruction[5]"
%empty_fn_caller_caller = function_ref @empty_fn_caller_caller : $@convention(thin) () -> ()
apply %empty_fn_caller_caller() : $@convention(thin) () -> ()
specify_test "is-deinit-barrier @instruction[7]"
%unknown = function_ref @unknown : $@convention(thin) () -> ()
apply %unknown() : $@convention(thin) () -> ()
specify_test "is-deinit-barrier @instruction[9]"
%unknown_caller = function_ref @unknown_caller : $@convention(thin) () -> ()
apply %unknown_caller() : $@convention(thin) () -> ()
%retval = tuple ()
return %retval : $()
}
actor A {}
sil @getA : $() -> (@owned A)
sil @borrowA : $@yield_once @convention(thin) () -> @yields @guaranteed A
// CHECK-LABEL: begin running test 1 of {{[0-9]+}} on test_hop_to_executor: is-deinit-barrier
// CHECK: hop_to_executor
// CHECK: true
// CHECK-LABEL: end running test 1 of {{[0-9]+}} on test_hop_to_executor: is-deinit-barrier
sil [ossa] @test_hop_to_executor : $@convention(thin) () -> () {
%borrowA = function_ref @borrowA : $@yield_once @convention(thin) () -> @yields @guaranteed A
(%a, %token) = begin_apply %borrowA() : $@yield_once @convention(thin) () -> @yields @guaranteed A
specify_test "is-deinit-barrier @instruction"
hop_to_executor %a : $A
end_apply %token
%retval = tuple ()
return %retval : $()
}
// CHECK-LABEL: begin running test 1 of {{[0-9]+}} on test_instructions_1: is-deinit-barrier
// CHECK: debug_step
// CHECK: false
// CHECK-LABEL: end running test 1 of {{[0-9]+}} on test_instructions_1: is-deinit-barrier
// CHECK-LABEL: begin running test 2 of {{[0-9]+}} on test_instructions_1: is-deinit-barrier
// CHECK: load [trivial] {{%[^,]+}} : $*Builtin.Int32
// CHECK: true
// CHECK-LABEL: end running test 2 of {{[0-9]+}} on test_instructions_1: is-deinit-barrier
// CHECK-LABEL: begin running test 3 of {{[0-9]+}} on test_instructions_1: is-deinit-barrier
// CHECK: load [trivial] {{%[^,]+}} : $*Builtin.Int32
// CHECK: true
// CHECK-LABEL: end running test 3 of {{[0-9]+}} on test_instructions_1: is-deinit-barrier
sil [ossa] @test_instructions_1 : $@convention(thin) () -> () {
entry:
specify_test "is-deinit-barrier @instruction"
debug_step
%my_errno = global_addr @my_errno : $*Builtin.Int32
specify_test "is-deinit-barrier @instruction"
%my_errno_value = load [trivial] %my_errno : $*Int32
%global_var = global_addr @global_var : $*Builtin.Int32
specify_test "is-deinit-barrier @instruction"
%global_var_value = load [trivial] %global_var : $*Int32
%retval = tuple ()
return %retval : $()
}
// CHECK-LABEL: begin running test {{.*}} on rdar120656227: is-deinit-barrier
// CHECK: builtin "int_memmove_RawPointer_RawPointer_Int64"
// CHECK: true
// CHECK-LABEL: end running test {{.*}} on rdar120656227: is-deinit-barrier
sil [ossa] @rdar120656227 : $@convention(thin) (Builtin.RawPointer, Builtin.RawPointer) -> () {
bb0(%42 : $Builtin.RawPointer, %9 : $Builtin.RawPointer):
%14 = integer_literal $Builtin.Int64, 27
%28 = integer_literal $Builtin.Int1, 1
specify_test "is-deinit-barrier @instruction"
%43 = builtin "int_memmove_RawPointer_RawPointer_Int64"(%42 : $Builtin.RawPointer, %9 : $Builtin.RawPointer, %14 : $Builtin.Int64, %28 : $Builtin.Int1) : $()
%68 = tuple ()
return %68 : $()
}
|