|
| 1 | +// RUN: %target-sil-opt -enable-sil-verify-all %s -cleanup-debug-steps -sil-print-debuginfo | %FileCheck %s |
| 2 | + |
| 3 | +// REQUIRES: swift_in_compiler |
| 4 | + |
| 5 | +import Swift |
| 6 | +import Builtin |
| 7 | + |
| 8 | +sil @f : $@convention(thin) () -> () |
| 9 | + |
| 10 | +// CHECK-LABEL: sil @remove_after_previous_location |
| 11 | +// CHECK-NOT: debug_step |
| 12 | +// CHECK: } // end sil function 'remove_after_previous_location' |
| 13 | +sil @remove_after_previous_location : $@convention(thin) () -> () { |
| 14 | +bb0: |
| 15 | + %f = function_ref @f : $@convention(thin) () -> () |
| 16 | + %a = apply %f() : $@convention(thin) () -> (), loc "a.swift":1:2 |
| 17 | + debug_step, loc "a.swift":1:2 |
| 18 | + %r = tuple () |
| 19 | + return %r : $() |
| 20 | +} |
| 21 | + |
| 22 | +// CHECK-LABEL: sil @dont_remove_after_previous_location |
| 23 | +// CHECK: debug_step |
| 24 | +// CHECK: } // end sil function 'dont_remove_after_previous_location' |
| 25 | +sil @dont_remove_after_previous_location : $@convention(thin) () -> () { |
| 26 | +bb0: |
| 27 | + %f = function_ref @f : $@convention(thin) () -> () |
| 28 | + %a = apply %f() : $@convention(thin) () -> (), loc "a.swift":1:2 |
| 29 | + %r = tuple (), loc "a.swift":27:2 |
| 30 | + debug_step, loc "a.swift":1:2 |
| 31 | + return %r : $() |
| 32 | +} |
| 33 | + |
| 34 | +// CHECK-LABEL: sil @remove_two_after_previous_location |
| 35 | +// CHECK-NOT: debug_step |
| 36 | +// CHECK: } // end sil function 'remove_two_after_previous_location' |
| 37 | +sil @remove_two_after_previous_location : $@convention(thin) () -> () { |
| 38 | +bb0: |
| 39 | + %f = function_ref @f : $@convention(thin) () -> () |
| 40 | + %a = apply %f() : $@convention(thin) () -> (), loc "a.swift":1:2 |
| 41 | + debug_step, loc "a.swift":1:2 |
| 42 | + debug_step, loc "a.swift":1:2 |
| 43 | + %r = tuple () |
| 44 | + return %r : $() |
| 45 | +} |
| 46 | + |
| 47 | +// CHECK-LABEL: sil @remove_before_next_location |
| 48 | +// CHECK-NOT: debug_step |
| 49 | +// CHECK: } // end sil function 'remove_before_next_location' |
| 50 | +sil @remove_before_next_location : $@convention(thin) () -> () { |
| 51 | +bb0: |
| 52 | + %f = function_ref @f : $@convention(thin) () -> () |
| 53 | + %a = apply %f() : $@convention(thin) () -> () |
| 54 | + debug_step, loc "a.swift":1:2 |
| 55 | + %r = tuple (), loc "<compiler-generated>":0:0 |
| 56 | + return %r : $(), loc "a.swift":1:2 |
| 57 | +} |
| 58 | + |
| 59 | +// CHECK-LABEL: sil @dont_remove_before_next_location |
| 60 | +// CHECK: debug_step |
| 61 | +// CHECK: } // end sil function 'dont_remove_before_next_location' |
| 62 | +sil @dont_remove_before_next_location : $@convention(thin) () -> () { |
| 63 | +bb0: |
| 64 | + %f = function_ref @f : $@convention(thin) () -> () |
| 65 | + %a = apply %f() : $@convention(thin) () -> () |
| 66 | + debug_step, loc "a.swift":1:2 |
| 67 | + %r = tuple (), loc "a.swift":27:2 |
| 68 | + return %r : $(), loc "a.swift":1:2 |
| 69 | +} |
| 70 | + |
| 71 | +// CHECK-LABEL: sil @remove_two_before_next_location |
| 72 | +// CHECK-NOT: debug_step |
| 73 | +// CHECK: } // end sil function 'remove_two_before_next_location' |
| 74 | +sil @remove_two_before_next_location : $@convention(thin) () -> () { |
| 75 | +bb0: |
| 76 | + %f = function_ref @f : $@convention(thin) () -> () |
| 77 | + %a = apply %f() : $@convention(thin) () -> () |
| 78 | + debug_step, loc "a.swift":1:2 |
| 79 | + debug_step, loc "a.swift":1:2 |
| 80 | + %r = tuple (), loc "<compiler-generated>":0:0 |
| 81 | + return %r : $(), loc "a.swift":1:2 |
| 82 | +} |
| 83 | + |
| 84 | +// CHECK-LABEL: sil @remove_null_location |
| 85 | +// CHECK-NOT: debug_step |
| 86 | +// CHECK: } // end sil function 'remove_null_location' |
| 87 | +sil @remove_null_location : $@convention(thin) () -> () { |
| 88 | +bb0: |
| 89 | + %f = function_ref @f : $@convention(thin) () -> () |
| 90 | + %a = apply %f() : $@convention(thin) () -> () |
| 91 | + debug_step, loc "<compiler-generated>":0:0 |
| 92 | + %r = tuple () |
| 93 | + return %r : $(), loc "a.swift":1:2 |
| 94 | +} |
| 95 | +// CHECK-LABEL: sil @dont_remove_one |
| 96 | +// CHECK: debug_step |
| 97 | +// CHECK: } // end sil function 'dont_remove_one' |
| 98 | +sil @dont_remove_one : $@convention(thin) () -> () { |
| 99 | +bb0: |
| 100 | + %f = function_ref @f : $@convention(thin) () -> () |
| 101 | + %a = apply %f() : $@convention(thin) () -> () |
| 102 | + debug_step, loc "a.swift":1:2 |
| 103 | + %r = tuple () |
| 104 | + return %r : $() |
| 105 | +} |
| 106 | + |
| 107 | +// CHECK-LABEL: sil @replace_three_with_one |
| 108 | +// CHECK: apply |
| 109 | +// CHECK-NEXT: debug_step , loc "a.swift":1:2 |
| 110 | +// CHECK-NEXT: tuple |
| 111 | +// CHECK: } // end sil function 'replace_three_with_one' |
| 112 | +sil @replace_three_with_one : $@convention(thin) () -> () { |
| 113 | +bb0: |
| 114 | + %f = function_ref @f : $@convention(thin) () -> () |
| 115 | + %a = apply %f() : $@convention(thin) () -> () |
| 116 | + debug_step, loc "a.swift":1:2 |
| 117 | + debug_step, loc "a.swift":1:2 |
| 118 | + debug_step, loc "a.swift":1:2 |
| 119 | + %r = tuple () |
| 120 | + return %r : $() |
| 121 | +} |
| 122 | + |
| 123 | +// CHECK-LABEL: sil @replace_three_with_two |
| 124 | +// CHECK: apply |
| 125 | +// CHECK-NEXT: debug_step , loc "a.swift":1:2 |
| 126 | +// CHECK-NEXT: debug_step , loc "a.swift":2:3 |
| 127 | +// CHECK-NEXT: tuple |
| 128 | +// CHECK: } // end sil function 'replace_three_with_two' |
| 129 | +sil @replace_three_with_two : $@convention(thin) () -> () { |
| 130 | +bb0: |
| 131 | + %f = function_ref @f : $@convention(thin) () -> () |
| 132 | + %a = apply %f() : $@convention(thin) () -> () |
| 133 | + debug_step, loc "a.swift":1:2 |
| 134 | + debug_step, loc "a.swift":2:3 |
| 135 | + debug_step, loc "a.swift":2:3 |
| 136 | + %r = tuple () |
| 137 | + return %r : $() |
| 138 | +} |
| 139 | + |
| 140 | + |
| 141 | +// CHECK-LABEL: sil @dont_remove_two |
| 142 | +// CHECK: debug_step |
| 143 | +// CHECK-NEXT: debug_step |
| 144 | +// CHECK: } // end sil function 'dont_remove_two' |
| 145 | +sil @dont_remove_two : $@convention(thin) () -> () { |
| 146 | +bb0: |
| 147 | + %f = function_ref @f : $@convention(thin) () -> () |
| 148 | + %a = apply %f() : $@convention(thin) () -> () |
| 149 | + debug_step, loc "a.swift":1:2 |
| 150 | + debug_step, loc "a.swift":2:3 |
| 151 | + %r = tuple () |
| 152 | + return %r : $() |
| 153 | +} |
| 154 | + |
0 commit comments