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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921
|
// RUN: %target-sil-opt -module-name infer -test-runner %s 2>&1 | %FileCheck %s
import Builtin
//===----------------------------------------------------------------------===//
// MARK: Declarations
//===----------------------------------------------------------------------===//
class Klass {
}
class ContainsKlass {
var computedKlass: Klass { get }
final var klass: Klass
init()
}
struct KlassPair {
var lhs: Klass
var rhs: Klass
}
class KlassWithKlassPair {
var ns1: KlassPair { get }
var ns2: (KlassPair, KlassPair) { get }
}
sil @getKlass : $@convention(thin) () -> @owned Klass
sil @getContainsKlass : $@convention(thin) () -> @owned ContainsKlass
sil @useIndirect : $@convention(thin) <T> (@in_guaranteed T) -> ()
sil @sideEffect : $@convention(thin) () -> ()
enum FakeOptional<T> {
case none
case some(T)
}
enum FirstSecondEnum<T> {
case first
case second(T)
}
enum FirstSecondThirdEnum<T> {
case first
case second(T)
case third(FakeOptional<T>)
}
//===----------------------------------------------------------------------===//
// MARK: Tests
//===----------------------------------------------------------------------===//
// CHECK-LABEL: begin running test {{[0-9]+}} of {{[0-9]+}} on simple_test_case: variable-name-inference with: @trace[0]
// CHECK: Input Value: %1 = apply %0() : $@convention(thin) () -> @owned Klass
// CHECK: Name: 'MyName'
// CHECK: Root: %1 = apply %0() : $@convention(thin) () -> @owned Klass
// CHECK: end running test {{[0-9]+}} of {{[0-9]+}} on simple_test_case: variable-name-inference with: @trace[0]
sil [ossa] @simple_test_case : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%1 = apply %0() : $@convention(thin) () -> @owned Klass
debug_value [trace] %1 : $Klass
debug_value %1 : $Klass, let, name "MyName"
destroy_value %1 : $Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test {{[0-9]+}} of {{[0-9]+}} on temporary_init_with_copy_addr: variable-name-inference with: @trace[0]
// CHECK: Input Value: %4 = alloc_stack $Klass
// CHECK: Name: 'MyName'
// CHECK: Root: %2 = alloc_stack $Klass, var, name "MyName"
// CHECK: end running test {{[0-9]+}} of {{[0-9]+}} on temporary_init_with_copy_addr: variable-name-inference with: @trace[0]
sil [ossa] @temporary_init_with_copy_addr : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%1 = apply %0() : $@convention(thin) () -> @owned Klass
%2 = alloc_stack $Klass, name "MyName"
store %1 to [init] %2 : $*Klass
%temp = alloc_stack $Klass
copy_addr %2 to [init] %temp : $*Klass
debug_value [trace] %temp : $*Klass
%use = function_ref @useIndirect : $@convention(thin) <T> (@in_guaranteed T) -> ()
apply %use<Klass>(%temp) : $@convention(thin) <T> (@in_guaranteed T) -> ()
destroy_addr %temp : $*Klass
dealloc_stack %temp : $*Klass
destroy_addr %2 : $*Klass
dealloc_stack %2 : $*Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test {{[0-9]+}} of {{[0-9]+}} on temporary_init_with_store: variable-name-inference with: @trace[0]
// CHECK: Input Value: %3 = alloc_stack $Klass
// CHECK: Name: 'MyName'
// CHECK: Root: %1 = apply %0()
// CHECK: end running test {{[0-9]+}} of {{[0-9]+}} on temporary_init_with_store: variable-name-inference with: @trace[0]
sil [ossa] @temporary_init_with_store : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%1 = apply %0() : $@convention(thin) () -> @owned Klass
debug_value %1 : $Klass, name "MyName", let
%temp = alloc_stack $Klass
store %1 to [init] %temp : $*Klass
debug_value [trace] %temp : $*Klass
%use = function_ref @useIndirect : $@convention(thin) <T> (@in_guaranteed T) -> ()
apply %use<Klass>(%temp) : $@convention(thin) <T> (@in_guaranteed T) -> ()
destroy_addr %temp : $*Klass
dealloc_stack %temp : $*Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test {{.*}} of {{.*}} on look_through_accessors_get: variable-name-inference with: @trace[0]
// CHECK: Name: 'myName.computedKlass'
// CHECK: Root: %2 = move_value [lexical] [var_decl]
// CHECK: end running test {{.*}} of {{.*}} on look_through_accessors_get: variable-name-inference with: @trace[0]
sil [ossa] @look_through_accessors_get : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getContainsKlass : $@convention(thin) () -> @owned ContainsKlass
%1 = apply %0() : $@convention(thin) () -> @owned ContainsKlass
%3 = move_value [lexical] [var_decl] %1 : $ContainsKlass
debug_value %3 : $ContainsKlass, let, name "myName"
%5 = begin_borrow %3 : $ContainsKlass
%6 = class_method %5 : $ContainsKlass, #ContainsKlass.computedKlass!getter : (ContainsKlass) -> () -> Klass, $@convention(method) (@guaranteed ContainsKlass) -> @owned Klass
%7 = apply %6(%5) : $@convention(method) (@guaranteed ContainsKlass) -> @owned Klass
debug_value [trace] %7 : $Klass
end_borrow %5 : $ContainsKlass
destroy_value %7 : $Klass
destroy_value %3 : $ContainsKlass
%13 = tuple ()
return %13 : $()
}
sil [thunk] @test_reabstraction_thunk : $@convention(thin) (@guaranteed @callee_guaranteed () -> ()) -> @out ()
// CHECK-LABEL: begin running test {{.*}} of {{.*}} on handle_function_conversion_reabstraction_thunks: variable-name-inference with: @trace[0]
// CHECK: Name: 'namedClosure'
// CHECK: Root: %0 = alloc_stack [lexical] $@callee_guaranteed () -> (), var, name "namedClosure"
// CHECK: end running test {{.*}} of {{.*}} on handle_function_conversion_reabstraction_thunks: variable-name-inference with: @trace[0]
sil [ossa] @handle_function_conversion_reabstraction_thunks : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%namedStack = alloc_stack [lexical] $@callee_guaranteed () -> (), var, name "namedClosure"
%f = function_ref @sideEffect : $@convention(thin) () -> ()
%pa = partial_apply [callee_guaranteed] %f() : $@convention(thin) () -> ()
store %pa to [init] %namedStack : $*@callee_guaranteed () -> ()
%temp = alloc_stack $@callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>
%access = begin_access [read] [static] %namedStack : $*@callee_guaranteed () -> ()
%load = load [copy] %access : $*@callee_guaranteed () -> ()
end_access %access : $*@callee_guaranteed () -> ()
%reabstract = function_ref @test_reabstraction_thunk : $@convention(thin) (@guaranteed @callee_guaranteed () -> ()) -> @out ()
%reabstract_partially_applied = partial_apply [callee_guaranteed] %reabstract(%load) : $@convention(thin) (@guaranteed @callee_guaranteed () -> ()) -> @out ()
%cvt = convert_function %reabstract_partially_applied : $@callee_guaranteed () -> @out () to $@callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>
store %cvt to [init] %temp : $*@callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>
debug_value [trace] %temp : $*@callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>
destroy_addr %temp : $*@callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>
dealloc_stack %temp : $*@callee_guaranteed @substituted <τ_0_0> () -> @out τ_0_0 for <()>
destroy_addr %namedStack : $*@callee_guaranteed () -> ()
dealloc_stack %namedStack : $*@callee_guaranteed () -> ()
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test {{.*}} of {{.*}} on mark_uninitialized_test: variable-name-inference with: @trace[0]
// CHECK: Name: 'self'
// CHECK: Root: %0 = alloc_stack $Klass, var, name "self"
// CHECK: end running test {{.*}} of {{.*}} on mark_uninitialized_test: variable-name-inference with: @trace[0]
sil [ossa] @mark_uninitialized_test : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%1 = alloc_stack $Klass, var, name "self"
%2 = mark_uninitialized [rootself] %1 : $*Klass
debug_value [trace] %2 : $*Klass
dealloc_stack %1 : $*Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test {{.*}} of {{.*}} on copyable_to_moveonlywrapper_addr_test: variable-name-inference with: @trace[0]
// CHECK: Name: 'self'
// CHECK: Root: %0 = alloc_stack $Klass, var, name "self"
// CHECK: end running test {{.*}} of {{.*}} on copyable_to_moveonlywrapper_addr_test: variable-name-inference with: @trace[0]
sil [ossa] @copyable_to_moveonlywrapper_addr_test : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = alloc_stack $Klass, var, name "self"
%1 = copyable_to_moveonlywrapper_addr %0 : $*Klass
%2 = moveonlywrapper_to_copyable_addr %1 : $*@moveOnly Klass
debug_value [trace] %2 : $*Klass
dealloc_stack %0 : $*Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on test_tuple_destructure: variable-name-inference with: @trace[0]
// CHECK: Input Value: (**%8**, %9) = destructure_tuple %7 : $(Klass, Klass)
// CHECK: Name: 'y.0'
// CHECK: Root: %5 = tuple (%1 : $Klass, %2 : $Klass)
// CHECK: end running test 1 of 1 on test_tuple_destructure: variable-name-inference with: @trace[0]
sil [ossa] @test_tuple_destructure : $@convention(thin) (@owned Klass, @guaranteed Klass, @guaranteed Klass) -> () {
bb0(%0 : @owned $Klass, %1 : @guaranteed $Klass, %2 : @guaranteed $Klass):
specify_test "variable-name-inference @trace[0]"
%3 = alloc_stack [lexical] $Klass, var, name "x"
store %0 to [init] %3 : $*Klass
%5 = tuple (%1 : $Klass, %2 : $Klass)
debug_value %5 : $(Klass, Klass), let, name "y", argno 2
%9 = copy_value %5 : $(Klass, Klass)
(%10, %11) = destructure_tuple %9 : $(Klass, Klass)
%12 = begin_access [modify] [static] %3 : $*Klass
debug_value [trace] %10 : $Klass
store %10 to [assign] %12 : $*Klass
end_access %12 : $*Klass
destroy_value %11 : $Klass
destroy_addr %3 : $*Klass
dealloc_stack %3 : $*Klass
%18 = tuple ()
return %18 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on test_tuple_extract: variable-name-inference with: @trace[0]
// CHECK: Input Value: %9 = tuple_extract %8 : $(Klass, Klass), 0
// CHECK: Name: 'y.0'
// CHECK: Root: %5 = tuple (%1 : $Klass, %2 : $Klass)
// CHECK: end running test 1 of 1 on test_tuple_extract: variable-name-inference with: @trace[0]
sil [ossa] @test_tuple_extract : $@convention(thin) (@owned Klass, @guaranteed Klass, @guaranteed Klass) -> () {
bb0(%0 : @owned $Klass, %1 : @guaranteed $Klass, %2 : @guaranteed $Klass):
specify_test "variable-name-inference @trace[0]"
%3 = alloc_stack [lexical] $Klass, var, name "x"
store %0 to [init] %3 : $*Klass
%5 = tuple (%1 : $Klass, %2 : $Klass)
debug_value %5 : $(Klass, Klass), let, name "y", argno 2
%9 = copy_value %5 : $(Klass, Klass)
%9a = begin_borrow %9 : $(Klass, Klass)
%10 = tuple_extract %9a : $(Klass, Klass), 0
debug_value [trace] %10 : $Klass
end_borrow %9a : $(Klass, Klass)
destroy_value %9 : $(Klass, Klass)
destroy_addr %3 : $*Klass
dealloc_stack %3 : $*Klass
%18 = tuple ()
return %18 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on test_struct_destructure: variable-name-inference with: @trace[0]
// CHECK: Input Value: (%8, **%9**) = destructure_struct %7 : $KlassPair
// CHECK: Name: 'y.rhs'
// CHECK: Root: %5 = struct $KlassPair (%1 : $Klass, %2 : $Klass)
// CHECK: end running test 1 of 1 on test_struct_destructure: variable-name-inference with: @trace[0]
sil [ossa] @test_struct_destructure : $@convention(thin) (@owned Klass, @guaranteed Klass, @guaranteed Klass) -> () {
bb0(%0 : @owned $Klass, %1 : @guaranteed $Klass, %2 : @guaranteed $Klass):
specify_test "variable-name-inference @trace[0]"
%3 = alloc_stack [lexical] $Klass, var, name "x"
store %0 to [init] %3 : $*Klass
%5 = struct $KlassPair (%1 : $Klass, %2 : $Klass)
debug_value %5 : $KlassPair, let, name "y", argno 2
%9 = copy_value %5 : $KlassPair
(%10, %11) = destructure_struct %9 : $KlassPair
%12 = begin_access [modify] [static] %3 : $*Klass
debug_value [trace] %11 : $Klass
store %10 to [assign] %12 : $*Klass
end_access %12 : $*Klass
destroy_value %11 : $Klass
destroy_addr %3 : $*Klass
dealloc_stack %3 : $*Klass
%18 = tuple ()
return %18 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on test_struct_extract: variable-name-inference with: @trace[0]
// CHECK: Input Value: %9 = struct_extract %8 : $KlassPair, #KlassPair.rhs
// CHECK: Name: 'y.rhs'
// CHECK: Root: %5 = struct $KlassPair (%1 : $Klass, %2 : $Klass)
// CHECK: end running test 1 of 1 on test_struct_extract: variable-name-inference with: @trace[0]
sil [ossa] @test_struct_extract : $@convention(thin) (@owned Klass, @guaranteed Klass, @guaranteed Klass) -> () {
bb0(%0 : @owned $Klass, %1 : @guaranteed $Klass, %2 : @guaranteed $Klass):
specify_test "variable-name-inference @trace[0]"
%3 = alloc_stack [lexical] $Klass, var, name "x"
store %0 to [init] %3 : $*Klass
%5 = struct $KlassPair (%1 : $Klass, %2 : $Klass)
debug_value %5 : $KlassPair, let, name "y", argno 2
%9 = copy_value %5 : $KlassPair
%9a = begin_borrow %9 : $KlassPair
%10 = struct_extract %9a : $KlassPair, #KlassPair.rhs
debug_value [trace] %10 : $Klass
end_borrow %9a : $KlassPair
destroy_value %9 : $KlassPair
destroy_addr %3 : $*Klass
dealloc_stack %3 : $*Klass
%18 = tuple ()
return %18 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on test_klass_tuple_struct_lookthrough: variable-name-inference with: @trace[0]
// CHECK: Input Value: %28 = load [copy] %27 : $*Klass
// CHECK: Name: 'arg2.ns2.1.rhs'
// CHECK: Root: %1 = argument of bb0 : $KlassWithKlassPair
// CHECK: end running test 1 of 1 on test_klass_tuple_struct_lookthrough: variable-name-inference with: @trace[0]
sil [ossa] @test_klass_tuple_struct_lookthrough : $@convention(thin) @async (@owned Klass, @guaranteed KlassWithKlassPair) -> () {
bb0(%0 : @owned $Klass, %1 : @guaranteed $KlassWithKlassPair):
debug_value %0 : $Klass, let, name "arg1", argno 1
debug_value %1 : $KlassWithKlassPair, let, name "arg2", argno 2
specify_test "variable-name-inference @trace[0]"
%2 = alloc_stack [lexical] $Klass, var, name "x"
store %0 to [init] %2 : $*Klass
%7 = alloc_stack $KlassPair
%8 = class_method %1 : $KlassWithKlassPair, #KlassWithKlassPair.ns1!getter : (KlassWithKlassPair) -> () -> KlassPair, $@convention(method) (@guaranteed KlassWithKlassPair) -> @owned KlassPair
%9 = apply %8(%1) : $@convention(method) (@guaranteed KlassWithKlassPair) -> @owned KlassPair
store %9 to [init] %7 : $*KlassPair
%11 = struct_element_addr %7 : $*KlassPair, #KlassPair.rhs
%12 = load [copy] %11 : $*Klass
destroy_addr %7 : $*KlassPair
%14 = begin_access [modify] [static] %2 : $*Klass
store %12 to [assign] %14 : $*Klass
end_access %14 : $*Klass
dealloc_stack %7 : $*KlassPair
%18 = alloc_stack $(KlassPair, KlassPair)
%19 = tuple_element_addr %18 : $*(KlassPair, KlassPair), 0
%20 = tuple_element_addr %18 : $*(KlassPair, KlassPair), 1
%21 = class_method %1 : $KlassWithKlassPair, #KlassWithKlassPair.ns2!getter : (KlassWithKlassPair) -> () -> (KlassPair, KlassPair), $@convention(method) (@guaranteed KlassWithKlassPair) -> (@owned KlassPair, @owned KlassPair)
%22 = apply %21(%1) : $@convention(method) (@guaranteed KlassWithKlassPair) -> (@owned KlassPair, @owned KlassPair)
(%23, %24) = destructure_tuple %22 : $(KlassPair, KlassPair)
store %23 to [init] %19 : $*KlassPair
store %24 to [init] %20 : $*KlassPair
%27 = tuple_element_addr %18 : $*(KlassPair, KlassPair), 1
%28 = struct_element_addr %27 : $*KlassPair, #KlassPair.rhs
%29 = load [copy] %28 : $*Klass
destroy_addr %18 : $*(KlassPair, KlassPair)
%31 = begin_access [modify] [static] %2 : $*Klass
debug_value [trace] %29 : $Klass
store %29 to [assign] %31 : $*Klass
end_access %31 : $*Klass
dealloc_stack %18 : $*(KlassPair, KlassPair)
destroy_addr %2 : $*Klass
dealloc_stack %2 : $*Klass
%37 = tuple ()
return %37 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on test_klass_tuple_struct_lookthrough_with_copyaddr: variable-name-inference with: @trace[0]
// CHECK: Input Value: %33 = load [copy] %32 : $*Klass
// CHECK: Name: 'arg2.ns2.1.rhs'
// CHECK: Root: %1 = argument of bb0 : $KlassWithKlassPair
// CHECK: end running test 1 of 1 on test_klass_tuple_struct_lookthrough_with_copyaddr: variable-name-inference with: @trace[0]
sil [ossa] @test_klass_tuple_struct_lookthrough_with_copyaddr : $@convention(thin) @async (@owned Klass, @guaranteed KlassWithKlassPair) -> () {
bb0(%0 : @owned $Klass, %1 : @guaranteed $KlassWithKlassPair):
debug_value %0 : $Klass, let, name "arg1", argno 1
debug_value %1 : $KlassWithKlassPair, let, name "arg2", argno 2
specify_test "variable-name-inference @trace[0]"
%2 = alloc_stack [lexical] $Klass, var, name "x"
store %0 to [init] %2 : $*Klass
%7 = alloc_stack $KlassPair
%8 = class_method %1 : $KlassWithKlassPair, #KlassWithKlassPair.ns1!getter : (KlassWithKlassPair) -> () -> KlassPair, $@convention(method) (@guaranteed KlassWithKlassPair) -> @owned KlassPair
%9 = apply %8(%1) : $@convention(method) (@guaranteed KlassWithKlassPair) -> @owned KlassPair
store %9 to [init] %7 : $*KlassPair
%11 = struct_element_addr %7 : $*KlassPair, #KlassPair.rhs
%12 = load [copy] %11 : $*Klass
destroy_addr %7 : $*KlassPair
%14 = begin_access [modify] [static] %2 : $*Klass
store %12 to [assign] %14 : $*Klass
end_access %14 : $*Klass
dealloc_stack %7 : $*KlassPair
%18 = alloc_stack $(KlassPair, KlassPair)
%19 = tuple_element_addr %18 : $*(KlassPair, KlassPair), 0
%20 = tuple_element_addr %18 : $*(KlassPair, KlassPair), 1
%21 = class_method %1 : $KlassWithKlassPair, #KlassWithKlassPair.ns2!getter : (KlassWithKlassPair) -> () -> (KlassPair, KlassPair), $@convention(method) (@guaranteed KlassWithKlassPair) -> (@owned KlassPair, @owned KlassPair)
%22 = apply %21(%1) : $@convention(method) (@guaranteed KlassWithKlassPair) -> (@owned KlassPair, @owned KlassPair)
(%23, %24) = destructure_tuple %22 : $(KlassPair, KlassPair)
store %23 to [init] %19 : $*KlassPair
store %24 to [init] %20 : $*KlassPair
%18a = alloc_stack $(KlassPair, KlassPair)
%19a = tuple_element_addr %18a : $*(KlassPair, KlassPair), 0
copy_addr [take] %19 to [init] %19a : $*KlassPair
%20a = tuple_element_addr %18a : $*(KlassPair, KlassPair), 1
copy_addr [take] %20 to [init] %20a : $*KlassPair
%27 = tuple_element_addr %18a : $*(KlassPair, KlassPair), 1
%28 = struct_element_addr %27 : $*KlassPair, #KlassPair.rhs
%29 = load [copy] %28 : $*Klass
destroy_addr %18a : $*(KlassPair, KlassPair)
%31 = begin_access [modify] [static] %2 : $*Klass
debug_value [trace] %29 : $Klass
store %29 to [assign] %31 : $*Klass
end_access %31 : $*Klass
dealloc_stack %18a : $*(KlassPair, KlassPair)
dealloc_stack %18 : $*(KlassPair, KlassPair)
destroy_addr %2 : $*Klass
dealloc_stack %2 : $*Klass
%37 = tuple ()
return %37 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on function_argument_inference_through_structextract: variable-name-inference with: @trace[0]
// CHECK: Input Value: %3 = copy_value %2 : $Klass
// CHECK: Name: 'self.lhs'
// CHECK: Root: %0 = argument of bb0 : $KlassPair
// CHECK: end running test 1 of 1 on function_argument_inference_through_structextract: variable-name-inference with: @trace[0]
sil [ossa] @function_argument_inference_through_structextract : $@convention(thin) (@guaranteed KlassPair) -> @owned Klass {
bb0(%0 : @guaranteed $KlassPair):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $KlassPair, let, name "self", argno 1
%2 = struct_extract %0 : $KlassPair, #KlassPair.lhs
%3 = copy_value %2 : $Klass
debug_value [trace] %3 : $Klass
return %3 : $Klass
}
// CHECK-LABEL: begin running test 1 of 1 on function_argument_inference_through_uncheckedenumdata: variable-name-inference with: @trace[0]
// CHECK: Input Value: %3 = copy_value %2 : $Klass
// CHECK: Name: 'self.some'
// CHECK: Root: %0 = argument of bb0 : $FakeOptional<Klass>
// CHECK: end running test 1 of 1 on function_argument_inference_through_uncheckedenumdata: variable-name-inference with: @trace[0]
sil [ossa] @function_argument_inference_through_uncheckedenumdata : $@convention(thin) (@guaranteed FakeOptional<Klass>) -> @owned Klass {
bb0(%0 : @guaranteed $FakeOptional<Klass>):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $FakeOptional<Klass>, let, name "self", argno 1
%2 = unchecked_enum_data %0 : $FakeOptional<Klass>, #FakeOptional.some!enumelt
%3 = copy_value %2 : $Klass
debug_value [trace] %3 : $Klass
return %3 : $Klass
}
// CHECK-LABEL: begin running test 1 of 1 on function_argument_inference_through_uncheckedtakeenumdataaddr: variable-name-inference with: @trace[0]
// CHECK: Input Value: %3 = load [take] %2 : $*Klass
// CHECK: Name: 'self.some'
// CHECK: Root: %0 = argument of bb0 : $*FakeOptional<Klass>
// CHECK: end running test 1 of 1 on function_argument_inference_through_uncheckedtakeenumdataaddr: variable-name-inference with: @trace[0]
sil [ossa] @function_argument_inference_through_uncheckedtakeenumdataaddr : $@convention(thin) (@in FakeOptional<Klass>) -> @owned Klass {
bb0(%0 : $*FakeOptional<Klass>):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $*FakeOptional<Klass>, let, name "self", argno 1
%2 = unchecked_take_enum_data_addr %0 : $*FakeOptional<Klass>, #FakeOptional.some!enumelt
%3 = load [take] %2 : $*Klass
debug_value [trace] %3 : $Klass
return %3 : $Klass
}
// CHECK-LABEL: begin running test 1 of 1 on function_argument_inference_through_uncheckedtakeenumdataaddr_2: variable-name-inference with: @trace[0]
// CHECK: Input Value: %2 = unchecked_take_enum_data_addr %0
// CHECK: Name: 'self.some'
// CHECK: Root: %0 = argument of bb0 : $*FakeOptional<Klass>
// CHECK: end running test 1 of 1 on function_argument_inference_through_uncheckedtakeenumdataaddr_2: variable-name-inference with: @trace[0]
sil [ossa] @function_argument_inference_through_uncheckedtakeenumdataaddr_2 : $@convention(thin) (@in FakeOptional<Klass>) -> @owned Klass {
bb0(%0 : $*FakeOptional<Klass>):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $*FakeOptional<Klass>, let, name "self", argno 1
%2 = unchecked_take_enum_data_addr %0 : $*FakeOptional<Klass>, #FakeOptional.some!enumelt
debug_value [trace] %2 : $*Klass
%3 = load [take] %2 : $*Klass
return %3 : $Klass
}
// For diamonds, we just recursively visit the uses of the phi and take the
// first one that gives a value. This is generally used for diagnostics, so we
// are ok with just giving one.
//
// TODO: If we need to do better, we can perhaps emit all of them.
// CHECK-LABEL: begin running test 1 of 1 on handle_diamond: variable-name-inference with: @trace[0]
// CHECK: Input Value: %9 = argument of bb3
// CHECK: Name: 'myname.some'
// CHECK: Root: %0 = argument of bb0
// CHECK: end running test 1 of 1 on handle_diamond: variable-name-inference with: @trace[0]
sil [ossa] @handle_diamond : $@convention(method) (@guaranteed FirstSecondEnum<Klass>) -> @sil_sending @owned FakeOptional<Klass> {
bb0(%0 : @guaranteed $FirstSecondEnum<Klass>):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $FirstSecondEnum<Klass>, var, name "myname"
switch_enum %0 : $FirstSecondEnum<Klass>, case #FirstSecondEnum.first!enumelt: bb1, case #FirstSecondEnum.second!enumelt: bb2
bb1:
%nil = enum $FakeOptional<Klass>, #FakeOptional.none!enumelt
br bb3(%nil : $FakeOptional<Klass>)
bb2(%1 : @guaranteed $Klass):
%2 = copy_value %1 : $Klass
%3 = enum $FakeOptional<Klass>, #FakeOptional.some!enumelt, %2 : $Klass
br bb3(%3 : $FakeOptional<Klass>)
bb3(%4 : @owned $FakeOptional<Klass>):
debug_value [trace] %4 : $FakeOptional<Klass>
return %4 : $FakeOptional<Klass>
}
// For diamonds, we just recursively visit the uses of the phi and take the
// first one that gives a value. This is generally used for diagnostics, so we
// are ok with just giving one.
//
// TODO: If we need to do better, we can perhaps emit all of them.
// CHECK-LABEL: begin running test 1 of 1 on handle_loop: variable-name-inference with: @trace[0]
// CHECK: Input Value: %16 = argument of bb5
// CHECK: Name: 'myname.some.third'
// CHECK: Root: %0 = argument of bb0
// CHECK: end running test 1 of 1 on handle_loop: variable-name-inference with: @trace[0]
sil [ossa] @handle_loop : $@convention(method) (@guaranteed FirstSecondThirdEnum<Klass>) -> @sil_sending @owned FirstSecondThirdEnum<Klass> {
bb0(%0 : @guaranteed $FirstSecondThirdEnum<Klass>):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $FirstSecondThirdEnum<Klass>, var, name "myname"
%0a = copy_value %0 : $FirstSecondThirdEnum<Klass>
br bb1(%0a : $FirstSecondThirdEnum<Klass>)
bb1(%1a : @owned $FirstSecondThirdEnum<Klass>):
br bb2(%1a : $FirstSecondThirdEnum<Klass>)
bb2(%1b : @owned $FirstSecondThirdEnum<Klass>):
switch_enum %1b : $FirstSecondThirdEnum<Klass>, case #FirstSecondThirdEnum.first!enumelt: bb3, case #FirstSecondThirdEnum.second!enumelt: bb4, case #FirstSecondThirdEnum.third!enumeult: bb4a
bb3:
%nil = enum $FirstSecondThirdEnum<Klass>, #FirstSecondThirdEnum.first!enumelt
br bb5(%nil : $FirstSecondThirdEnum<Klass>)
bb4(%1 : @owned $Klass):
%2 = copy_value %1 : $Klass
%3 = enum $FakeOptional<Klass>, #FakeOptional.some!enumelt, %2 : $Klass
%3a = enum $FirstSecondThirdEnum<Klass>, #FirstSecondThirdEnum.third!enumelt, %3 : $FakeOptional<Klass>
destroy_value %1 : $Klass
br bb5(%3a : $FirstSecondThirdEnum<Klass>)
bb5(%4 : @owned $FirstSecondThirdEnum<Klass>):
br bb6
bb6:
cond_br undef, bb7, bb8
bb7:
br bb1(%4 : $FirstSecondThirdEnum<Klass>)
bb4a(%unused : @owned $FakeOptional<Klass>):
unreachable
bb8:
debug_value [trace] %4 : $FirstSecondThirdEnum<Klass>
return %4 : $FirstSecondThirdEnum<Klass>
}
// Make sure that we properly scope by switching edge order.
//
// CHECK-LABEL: begin running test 1 of 1 on handle_loop_other_order: variable-name-inference with: @trace[0]
// CHECK: Input Value: %16 = argument of bb5
// CHECK: Name: 'myname.some.third'
// CHECK: Root: %0 = argument of bb0
// CHECK: end running test 1 of 1 on handle_loop_other_order: variable-name-inference with: @trace[0]
sil [ossa] @handle_loop_other_order : $@convention(method) (@guaranteed FirstSecondThirdEnum<Klass>) -> @sil_sending @owned FirstSecondThirdEnum<Klass> {
bb0(%0 : @guaranteed $FirstSecondThirdEnum<Klass>):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $FirstSecondThirdEnum<Klass>, var, name "myname"
%0a = copy_value %0 : $FirstSecondThirdEnum<Klass>
br bb1(%0a : $FirstSecondThirdEnum<Klass>)
bb1(%1a : @owned $FirstSecondThirdEnum<Klass>):
br bb2(%1a : $FirstSecondThirdEnum<Klass>)
bb2(%1b : @owned $FirstSecondThirdEnum<Klass>):
switch_enum %1b : $FirstSecondThirdEnum<Klass>, case #FirstSecondThirdEnum.first!enumelt: bb4, case #FirstSecondThirdEnum.second!enumelt: bb3, case #FirstSecondThirdEnum.third!enumeult: bb4a
bb3(%1 : @owned $Klass):
%2 = copy_value %1 : $Klass
%3 = enum $FakeOptional<Klass>, #FakeOptional.some!enumelt, %2 : $Klass
%3a = enum $FirstSecondThirdEnum<Klass>, #FirstSecondThirdEnum.third!enumelt, %3 : $FakeOptional<Klass>
destroy_value %1 : $Klass
br bb5(%3a : $FirstSecondThirdEnum<Klass>)
bb4:
%nil = enum $FirstSecondThirdEnum<Klass>, #FirstSecondThirdEnum.first!enumelt
br bb5(%nil : $FirstSecondThirdEnum<Klass>)
bb5(%4 : @owned $FirstSecondThirdEnum<Klass>):
br bb6
bb6:
cond_br undef, bb7, bb8
bb7:
br bb1(%4 : $FirstSecondThirdEnum<Klass>)
bb4a(%unused : @owned $FakeOptional<Klass>):
unreachable
bb8:
debug_value [trace] %4 : $FirstSecondThirdEnum<Klass>
return %4 : $FirstSecondThirdEnum<Klass>
}
// Test that we can properly handle code generation from a borrowing loadable parameter
//
// CHECK-LABEL: begin running test 1 of 1 on loadable_borrowing_test: variable-name-inference with: @trace[0]
// CHECK: Input Value: %8 = store_borrow %6 to %7 : $*Klass // user: %9
// CHECK: Name: 'x'
// CHECK: Root: %3 = mark_unresolved_non_copyable_value [no_consume_or_assign] %2
// CHECK: end running test 1 of 1 on loadable_borrowing_test: variable-name-inference with: @trace[0]
sil hidden [ossa] @loadable_borrowing_test : $@convention(thin) @async (@guaranteed Klass) -> () {
bb0(%0 : @noImplicitCopy @guaranteed $Klass):
specify_test "variable-name-inference @trace[0]"
%1 = copyable_to_moveonlywrapper [guaranteed] %0 : $Klass
%2 = copy_value %1 : $@moveOnly Klass
%3 = mark_unresolved_non_copyable_value [no_consume_or_assign] %2 : $@moveOnly Klass
debug_value %3 : $@moveOnly Klass, let, name "x", argno 1
%7 = begin_borrow %3 : $@moveOnly Klass
%8 = moveonlywrapper_to_copyable [guaranteed] %7 : $@moveOnly Klass
%9 = alloc_stack $Klass
%10 = store_borrow %8 to %9 : $*Klass
debug_value [trace] %10 : $*Klass
end_borrow %10 : $*Klass
dealloc_stack %9 : $*Klass
end_borrow %7 : $@moveOnly Klass
destroy_value %3 : $@moveOnly Klass
%25 = tuple ()
return %25 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on store_borrow_tuple_test: variable-name-inference with: @trace[0]
// CHECK: Input Value: %25 = store_borrow %23 to %24 : $*Klass
// CHECK: Name: 'z'
// CHECK: Root: %20 = move_value [lexical] [var_decl] %19 : $Klass
// CHECK: end running test 1 of 1 on store_borrow_tuple_test: variable-name-inference with: @trace[0]
sil hidden [ossa] @store_borrow_tuple_test : $@convention(thin) @async () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%2 = integer_literal $Builtin.IntLiteral, 0
%7 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%8 = apply %7() : $@convention(thin) () -> @owned Klass
%9 = tuple (%2 : $Builtin.IntLiteral, %8 : $Klass)
%10 = move_value [lexical] [var_decl] %9 : $(Builtin.IntLiteral, Klass)
debug_value %10 : $(Builtin.IntLiteral, Klass), let, name "test"
%12 = begin_borrow %10 : $(Builtin.IntLiteral, Klass)
(%13, %14) = destructure_tuple %12 : $(Builtin.IntLiteral, Klass)
%15 = copy_value %14 : $Klass
%16 = tuple (%13 : $Builtin.IntLiteral, %15 : $Klass)
%17 = alloc_stack $(Builtin.IntLiteral, Klass)
store %16 to [init] %17 : $*(Builtin.IntLiteral, Klass)
// original location of use.
destroy_addr %17 : $*(Builtin.IntLiteral, Klass)
dealloc_stack %17 : $*(Builtin.IntLiteral, Klass)
end_borrow %12 : $(Builtin.IntLiteral, Klass)
%25 = begin_borrow %10 : $(Builtin.IntLiteral, Klass)
%26 = copy_value %25 : $(Builtin.IntLiteral, Klass)
(%27, %28) = destructure_tuple %26 : $(Builtin.IntLiteral, Klass)
%29 = move_value [lexical] [var_decl] %28 : $Klass
debug_value %29 : $Klass, let, name "z"
end_borrow %25 : $(Builtin.IntLiteral, Klass)
%32 = begin_borrow %29 : $Klass
%33 = alloc_stack $Klass
%34 = store_borrow %32 to %33 : $*Klass
debug_value [trace] %34 : $*Klass
%35 = function_ref @useIndirect : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
%36 = apply %35<Klass>(%34) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
end_borrow %34 : $*Klass
dealloc_stack %33 : $*Klass
end_borrow %32 : $Klass
%40 = begin_borrow %10 : $(Builtin.IntLiteral, Klass)
(%41, %42) = destructure_tuple %40 : $(Builtin.IntLiteral, Klass)
%43 = copy_value %42 : $Klass
%44 = tuple (%41 : $Builtin.IntLiteral, %43 : $Klass)
%45 = alloc_stack $(Builtin.IntLiteral, Klass)
store %44 to [init] %45 : $*(Builtin.IntLiteral, Klass)
%48 = apply %35<(Builtin.IntLiteral, Klass)>(%45) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
destroy_addr %45 : $*(Builtin.IntLiteral, Klass)
dealloc_stack %45 : $*(Builtin.IntLiteral, Klass)
end_borrow %40 : $(Builtin.IntLiteral, Klass)
destroy_value %29 : $Klass
destroy_value %10 : $(Builtin.IntLiteral, Klass)
%54 = tuple ()
return %54 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on store_borrow_tuple_test_2: variable-name-inference with: @trace[0]
// CHECK: Input Value: %11 = alloc_stack $(Builtin.IntLiteral, Klass)
// CHECK: Name: 'test'
// CHECK: Root: %4 = move_value [lexical] [var_decl] %3 : $(Builtin.IntLiteral, Klass)
// CHECK: end running test 1 of 1 on store_borrow_tuple_test_2: variable-name-inference with: @trace[0]
sil hidden [ossa] @store_borrow_tuple_test_2 : $@convention(thin) @async () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%2 = integer_literal $Builtin.IntLiteral, 0
%7 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%8 = apply %7() : $@convention(thin) () -> @owned Klass
%9 = tuple (%2 : $Builtin.IntLiteral, %8 : $Klass)
%10 = move_value [lexical] [var_decl] %9 : $(Builtin.IntLiteral, Klass)
debug_value %10 : $(Builtin.IntLiteral, Klass), let, name "test"
%12 = begin_borrow %10 : $(Builtin.IntLiteral, Klass)
(%13, %14) = destructure_tuple %12 : $(Builtin.IntLiteral, Klass)
%15 = copy_value %14 : $Klass
%16 = tuple (%13 : $Builtin.IntLiteral, %15 : $Klass)
%17 = alloc_stack $(Builtin.IntLiteral, Klass)
store %16 to [init] %17 : $*(Builtin.IntLiteral, Klass)
debug_value [trace] %17 : $*(Builtin.IntLiteral, Klass)
// original location of use.
destroy_addr %17 : $*(Builtin.IntLiteral, Klass)
dealloc_stack %17 : $*(Builtin.IntLiteral, Klass)
end_borrow %12 : $(Builtin.IntLiteral, Klass)
%25 = begin_borrow %10 : $(Builtin.IntLiteral, Klass)
%26 = copy_value %25 : $(Builtin.IntLiteral, Klass)
(%27, %28) = destructure_tuple %26 : $(Builtin.IntLiteral, Klass)
%29 = move_value [lexical] [var_decl] %28 : $Klass
debug_value %29 : $Klass, let, name "z"
end_borrow %25 : $(Builtin.IntLiteral, Klass)
%32 = begin_borrow %29 : $Klass
%33 = alloc_stack $Klass
%34 = store_borrow %32 to %33 : $*Klass
%35 = function_ref @useIndirect : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
%36 = apply %35<Klass>(%34) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
end_borrow %34 : $*Klass
dealloc_stack %33 : $*Klass
end_borrow %32 : $Klass
%40 = begin_borrow %10 : $(Builtin.IntLiteral, Klass)
(%41, %42) = destructure_tuple %40 : $(Builtin.IntLiteral, Klass)
%43 = copy_value %42 : $Klass
%44 = tuple (%41 : $Builtin.IntLiteral, %43 : $Klass)
%45 = alloc_stack $(Builtin.IntLiteral, Klass)
store %44 to [init] %45 : $*(Builtin.IntLiteral, Klass)
%48 = apply %35<(Builtin.IntLiteral, Klass)>(%45) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
destroy_addr %45 : $*(Builtin.IntLiteral, Klass)
dealloc_stack %45 : $*(Builtin.IntLiteral, Klass)
end_borrow %40 : $(Builtin.IntLiteral, Klass)
destroy_value %29 : $Klass
destroy_value %10 : $(Builtin.IntLiteral, Klass)
%54 = tuple ()
return %54 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on init_existential_addr_temporary: variable-name-inference with: @trace[0]
// CHECK: Input Value: %2 = alloc_stack $Any
// CHECK: Name: 'my arg'
// CHECK: Root: %0 = argument of bb0
// CHECK: end running test 1 of 1 on init_existential_addr_temporary: variable-name-inference with: @trace[0]
sil [ossa] @init_existential_addr_temporary : $@convention(thin) (@owned Klass) -> () {
bb0(%0 : @owned $Klass):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $Klass, var, name "my arg"
%1 = alloc_stack $Any
%2 = init_existential_addr %1 : $*Any, $Klass
store %0 to [init] %2 : $*Klass
debug_value [trace] %1 : $*Any
destroy_addr %1 : $*Any
dealloc_stack %1 : $*Any
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on init_existential_addr_temporary_copy_addr: variable-name-inference with: @trace[0]
// CHECK: Input Value: %2 = alloc_stack $Any
// CHECK: Name: 'my arg'
// CHECK: Root: %0 = argument of bb0
// CHECK: end running test 1 of 1 on init_existential_addr_temporary_copy_addr: variable-name-inference with: @trace[0]
sil [ossa] @init_existential_addr_temporary_copy_addr : $@convention(thin) (@in Klass) -> () {
bb0(%0 : $*Klass):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $*Klass, var, name "my arg"
%1 = alloc_stack $Any
%2 = init_existential_addr %1 : $*Any, $Klass
copy_addr [take] %0 to [init] %2 : $*Klass
debug_value [trace] %1 : $*Any
destroy_addr %1 : $*Any
dealloc_stack %1 : $*Any
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on move_value_var_decl: variable-name-inference with: @trace[0]
// CHECK: Input Value: %2 = move_value [var_decl] %1 : $Klass
// CHECK: Name: 'MyName'
// CHECK: Root: %2 = move_value [var_decl] %1 : $Klass
// CHECK: end running test 1 of 1 on move_value_var_decl: variable-name-inference with: @trace[0]
sil [ossa] @move_value_var_decl : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%1 = apply %0() : $@convention(thin) () -> @owned Klass
%2 = move_value [var_decl] %1 : $Klass
debug_value %2 : $Klass, let, name "MyName"
debug_value [trace] %2 : $Klass
destroy_value %2 : $Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on move_value_var_decl_2: variable-name-inference with: @trace[0]
// CHECK: Input Value: %1 = apply %0() : $@convention(thin) () -> @owned Klass
// CHECK: Name: 'MyName'
// CHECK: Root: %1 = apply %0() : $@convention(thin) () -> @owned Klass
// CHECK: end running test 1 of 1 on move_value_var_decl_2: variable-name-inference with: @trace[0]
sil [ossa] @move_value_var_decl_2 : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%1 = apply %0() : $@convention(thin) () -> @owned Klass
debug_value [trace] %1 : $Klass
%2 = move_value [var_decl] %1 : $Klass
debug_value %2 : $Klass, let, name "MyName"
destroy_value %2 : $Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on move_value_var_decl_3: variable-name-inference with: @trace[0]
// CHECK-LABEL: Input Value: %1 = apply %0() : $@convention(thin) () -> @owned Klass
// CHECK-LABEL: Name: 'unknown'
// CHECK-LABEL: Root: 'unknown'
// CHECK-LABEL: end running test 1 of 1 on move_value_var_decl_3: variable-name-inference with: @trace[0]
sil [ossa] @move_value_var_decl_3 : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%1 = apply %0() : $@convention(thin) () -> @owned Klass
debug_value [trace] %1 : $Klass
%2 = move_value %1 : $Klass
debug_value %2 : $Klass, let, name "MyName"
destroy_value %2 : $Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on begin_borrow_var_decl: variable-name-inference with: @trace[0]
// CHECK: Input Value: %2 = begin_borrow [var_decl] %1 : $Klass
// CHECK: Name: 'MyName'
// CHECK: Root: %2 = begin_borrow [var_decl] %1 : $Klass
// CHECK: end running test 1 of 1 on begin_borrow_var_decl: variable-name-inference with: @trace[0]
sil [ossa] @begin_borrow_var_decl : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%1 = apply %0() : $@convention(thin) () -> @owned Klass
%2 = begin_borrow [var_decl] %1 : $Klass
debug_value %2 : $Klass, let, name "MyName"
debug_value [trace] %2 : $Klass
end_borrow %2 : $Klass
destroy_value %1 : $Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on begin_borrow_var_decl_2: variable-name-inference with: @trace[0]
// CHECK: Input Value: %1 = apply %0() : $@convention(thin) () -> @owned Klass
// CHECK: Name: 'MyName'
// CHECK: Root: %1 = apply %0() : $@convention(thin) () -> @owned Klass
// CHECK: end running test 1 of 1 on begin_borrow_var_decl_2: variable-name-inference with: @trace[0]
sil [ossa] @begin_borrow_var_decl_2 : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%1 = apply %0() : $@convention(thin) () -> @owned Klass
debug_value [trace] %1 : $Klass
%2 = begin_borrow [var_decl] %1 : $Klass
debug_value %2 : $Klass, let, name "MyName"
end_borrow %2 : $Klass
destroy_value %1 : $Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on begin_borrow_var_decl_3: variable-name-inference with: @trace[0]
// CHECK: Input Value: %1 = apply %0() : $@convention(thin) () -> @owned Klass
// CHECK: Name: 'unknown'
// CHECK: Root: 'unknown'
// CHECK: end running test 1 of 1 on begin_borrow_var_decl_3: variable-name-inference with: @trace[0]
sil [ossa] @begin_borrow_var_decl_3 : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @getKlass : $@convention(thin) () -> @owned Klass
%1 = apply %0() : $@convention(thin) () -> @owned Klass
debug_value [trace] %1 : $Klass
%2 = begin_borrow %1 : $Klass
debug_value %2 : $Klass, let, name "MyName"
end_borrow %2 : $Klass
destroy_value %1 : $Klass
%9999 = tuple ()
return %9999 : $()
}
// CHECK-LABEL: begin running test 1 of 1 on infer_through_end_init_let_ref: variable-name-inference with: @trace[0]
// CHECK: Input Value: %2 = end_init_let_ref %0 : $Klass
// CHECK: Name: 'self'
// CHECK: Root: %0 = argument of bb0 : $Klass
// CHECK: end running test 1 of 1 on infer_through_end_init_let_ref: variable-name-inference with: @trace[0]
sil [ossa] @infer_through_end_init_let_ref : $@convention(thin) (@owned Klass) -> @owned Klass {
bb0(%0 : @owned $Klass):
specify_test "variable-name-inference @trace[0]"
debug_value %0 : $Klass, let, name "self", argno 2
%1 = end_init_let_ref %0 : $Klass
debug_value [trace] %1 : $Klass
return %1 : $Klass
}
// CHECK-LABEL: begin running test 1 of 1 on infer_for_closure: variable-name-inference with: @trace[0]
// CHECK: Input Value: %5 = convert_escape_to_noescape [not_guaranteed] %4 : $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
// CHECK: Name: 'closure1'
// CHECK: Root: %2 = move_value [lexical] [var_decl] %1 : $@callee_guaranteed () -> ()
// CHECK: end running test 1 of 1 on infer_for_closure: variable-name-inference with: @trace[0]
sil [ossa] @infer_for_closure : $@convention(thin) () -> () {
bb0:
specify_test "variable-name-inference @trace[0]"
%0 = function_ref @sideEffect : $@convention(thin) () -> ()
%1 = partial_apply [callee_guaranteed] %0() : $@convention(thin) () -> ()
%2 = move_value [lexical] [var_decl] %1 : $@callee_guaranteed () -> ()
debug_value %2 : $@callee_guaranteed () -> (), let, name "closure1"
%3 = copy_value %2 : $@callee_guaranteed () -> ()
%4 = convert_escape_to_noescape [not_guaranteed] %3 : $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
debug_value [trace] %4 : $@noescape @callee_guaranteed () -> ()
destroy_value %4 : $@noescape @callee_guaranteed () -> ()
destroy_value %3 : $@callee_guaranteed () -> ()
destroy_value %2 : $@callee_guaranteed () -> ()
%9999 = tuple ()
return %9999 : $()
}
|