|
| 1 | +// RUN: %target-sil-opt -compute-side-effects -unit-test-runner %s 2>&1 | %FileCheck %s |
| 2 | + |
| 3 | +// REQUIRES: swift_in_compiler |
| 4 | + |
| 5 | +sil [ossa] @unknown : $@convention(thin) () -> () |
| 6 | + |
| 7 | +sil [ossa] @unknown_caller : $@convention(thin) () -> () { |
| 8 | + %unknown = function_ref @unknown : $@convention(thin) () -> () |
| 9 | + apply %unknown() : $@convention(thin) () -> () |
| 10 | + %retval = tuple () |
| 11 | + return %retval : $() |
| 12 | +} |
| 13 | + |
| 14 | +sil [ossa] @empty_fn : $@convention(thin) () -> () { |
| 15 | + %retval = tuple () |
| 16 | + return %retval : $() |
| 17 | +} |
| 18 | + |
| 19 | +sil [ossa] @empty_fn_caller : $@convention(thin) () -> () { |
| 20 | + %empty_fn = function_ref @empty_fn : $@convention(thin) () -> () |
| 21 | + apply %empty_fn() : $@convention(thin) () -> () |
| 22 | + %retval = tuple () |
| 23 | + return %retval : $() |
| 24 | +} |
| 25 | + |
| 26 | +sil [ossa] @empty_fn_caller_caller : $@convention(thin) () -> () { |
| 27 | + %empty_fn_caller = function_ref @empty_fn_caller : $@convention(thin) () -> () |
| 28 | + apply %empty_fn_caller() : $@convention(thin) () -> () |
| 29 | + %retval = tuple () |
| 30 | + return %retval : $() |
| 31 | +} |
| 32 | + |
| 33 | + |
| 34 | +// CHECK-LABEL: begin running test 1 of {{[0-9]+}} on call_functions: dump-function |
| 35 | +// CHECK: [[EMPTY_FN:%[^,]+]] = function_ref @empty_fn |
| 36 | +// CHECK: [[EMPTY_FN_CALLER:%[^,]+]] = function_ref @empty_fn_caller |
| 37 | +// CHECK: [[EMPTY_FN_CALLER_CALLER:%[^,]+]] = function_ref @empty_fn_caller_caller |
| 38 | +// CHECK: [[UNKNOWN:%[^,]+]] = function_ref @unknown |
| 39 | +// CHECK: [[UNKNOWN_CALLER:%[^,]+]] = function_ref @unknown_caller |
| 40 | +// CHECK-LABEL: end running test 1 of {{[0-9]+}} on call_functions: dump-function |
| 41 | +// CHECK-LABEL: begin running test 2 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 42 | +// CHECK: apply [[EMPTY_FN]] |
| 43 | +// CHECK: false |
| 44 | +// CHECK-LABEL: end running test 2 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 45 | +// CHECK-LABEL: begin running test 3 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 46 | +// CHECK: apply [[EMPTY_FN_CALLER]] |
| 47 | +// CHECK: false |
| 48 | +// CHECK-LABEL: end running test 3 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 49 | +// CHECK-LABEL: begin running test 4 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 50 | +// CHECK: apply [[EMPTY_FN_CALLER_CALLER]] |
| 51 | +// CHECK: false |
| 52 | +// CHECK-LABEL: end running test 4 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 53 | +// CHECK-LABEL: begin running test 5 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 54 | +// CHECK: apply [[UNKNOWN]] |
| 55 | +// CHECK: true |
| 56 | +// CHECK-LABEL: end running test 5 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 57 | +// CHECK-LABEL: begin running test 6 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 58 | +// CHECK: apply [[UNKNOWN_CALLER]] |
| 59 | +// CHECK: true |
| 60 | +// CHECK-LABEL: end running test 6 of {{[0-9]+}} on call_functions: is-deinit-barrier |
| 61 | +sil [ossa] @call_functions : $@convention(thin) () -> () { |
| 62 | +entry: |
| 63 | + test_specification "dump-function" |
| 64 | + test_specification "is-deinit-barrier @instruction[1]" |
| 65 | + %empty_fn = function_ref @empty_fn : $@convention(thin) () -> () |
| 66 | + apply %empty_fn() : $@convention(thin) () -> () |
| 67 | + |
| 68 | + test_specification "is-deinit-barrier @instruction[3]" |
| 69 | + %empty_fn_caller = function_ref @empty_fn_caller : $@convention(thin) () -> () |
| 70 | + apply %empty_fn_caller() : $@convention(thin) () -> () |
| 71 | + |
| 72 | + test_specification "is-deinit-barrier @instruction[5]" |
| 73 | + %empty_fn_caller_caller = function_ref @empty_fn_caller_caller : $@convention(thin) () -> () |
| 74 | + apply %empty_fn_caller_caller() : $@convention(thin) () -> () |
| 75 | + |
| 76 | + test_specification "is-deinit-barrier @instruction[7]" |
| 77 | + %unknown = function_ref @unknown : $@convention(thin) () -> () |
| 78 | + apply %unknown() : $@convention(thin) () -> () |
| 79 | + |
| 80 | + test_specification "is-deinit-barrier @instruction[9]" |
| 81 | + %unknown_caller = function_ref @unknown_caller : $@convention(thin) () -> () |
| 82 | + apply %unknown_caller() : $@convention(thin) () -> () |
| 83 | + |
| 84 | + %retval = tuple () |
| 85 | + return %retval : $() |
| 86 | +} |
| 87 | + |
0 commit comments