|
| 1 | +// RUN: %target-sil-opt -test-runner %s 2>&1 | %FileCheck %s |
| 2 | + |
| 3 | +import Builtin |
| 4 | + |
| 5 | +class Klass {} |
| 6 | + |
| 7 | +sil @getKlass : $@convention(thin) () -> @owned Klass |
| 8 | +sil @useIndirect : $@convention(thin) <T> (@in_guaranteed T) -> () |
| 9 | + |
| 10 | +// CHECK-LABEL: begin running test {{[0-9]+}} of {{[0-9]+}} on simple_test_case: variable-name-inference with: @trace[0] |
| 11 | +// CHECK: Input Value: %1 = apply %0() : $@convention(thin) () -> @owned Klass |
| 12 | +// CHECK: Name: 'MyName' |
| 13 | +// CHECK: Root: %1 = apply %0() : $@convention(thin) () -> @owned Klass |
| 14 | +// CHECK: end running test {{[0-9]+}} of {{[0-9]+}} on simple_test_case: variable-name-inference with: @trace[0] |
| 15 | +sil [ossa] @simple_test_case : $@convention(thin) () -> () { |
| 16 | +bb0: |
| 17 | + specify_test "variable-name-inference @trace[0]" |
| 18 | + %0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass |
| 19 | + %1 = apply %0() : $@convention(thin) () -> @owned Klass |
| 20 | + debug_value [trace] %1 : $Klass |
| 21 | + debug_value %1 : $Klass, let, name "MyName" |
| 22 | + destroy_value %1 : $Klass |
| 23 | + %9999 = tuple () |
| 24 | + return %9999 : $() |
| 25 | +} |
| 26 | + |
| 27 | +// CHECK-LABEL: begin running test {{[0-9]+}} of {{[0-9]+}} on temporary_init_with_copy_addr: variable-name-inference with: @trace[0] |
| 28 | +// CHECK: Input Value: %4 = alloc_stack $Klass |
| 29 | +// CHECK: Name: 'MyName' |
| 30 | +// CHECK: Root: %2 = alloc_stack $Klass, var, name "MyName" |
| 31 | +// CHECK: end running test {{[0-9]+}} of {{[0-9]+}} on temporary_init_with_copy_addr: variable-name-inference with: @trace[0] |
| 32 | +sil [ossa] @temporary_init_with_copy_addr : $@convention(thin) () -> () { |
| 33 | +bb0: |
| 34 | + specify_test "variable-name-inference @trace[0]" |
| 35 | + %0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass |
| 36 | + %1 = apply %0() : $@convention(thin) () -> @owned Klass |
| 37 | + %2 = alloc_stack $Klass, name "MyName" |
| 38 | + store %1 to [init] %2 : $*Klass |
| 39 | + |
| 40 | + %temp = alloc_stack $Klass |
| 41 | + copy_addr %2 to [init] %temp : $*Klass |
| 42 | + debug_value [trace] %temp : $*Klass |
| 43 | + %use = function_ref @useIndirect : $@convention(thin) <T> (@in_guaranteed T) -> () |
| 44 | + apply %use<Klass>(%temp) : $@convention(thin) <T> (@in_guaranteed T) -> () |
| 45 | + |
| 46 | + destroy_addr %temp : $*Klass |
| 47 | + dealloc_stack %temp : $*Klass |
| 48 | + destroy_addr %2 : $*Klass |
| 49 | + dealloc_stack %2 : $*Klass |
| 50 | + %9999 = tuple () |
| 51 | + return %9999 : $() |
| 52 | +} |
0 commit comments