@@ -527,7 +527,7 @@ bb3: // Preds: bb1 bb2
527
527
// CHECK-NOT: load
528
528
// CHECK: bb3
529
529
// CHECK-NOT: load
530
- // CHECK: load
530
+ // CHECK: return
531
531
sil @load_to_load_irreducible_loop : $@convention(thin) () -> () {
532
532
bb0:
533
533
%0 = alloc_stack $Int32
@@ -565,7 +565,38 @@ bb3:
565
565
return %9999 : $()
566
566
}
567
567
568
- sil @xload_to_load_loop : $@convention(thin) () -> () {
568
+ // Forward store %1 and store %2 such that load %3 becomes an identity trivial cast.
569
+ // Both loads from %0 will be eliminated.
570
+ // CHECK-LABEL: sil @test_read_dependence_allows_forwarding_multi_bb_2 : $@convention(thin) (@inout A, A, A) -> A {
571
+ // CHECK: bb1
572
+ // CHECK: load
573
+ // CHECK-NOT: load
574
+ // CHECK: bb2
575
+ sil @test_read_dependence_allows_forwarding_multi_bb_2 : $@convention(thin) (@inout A, A, A) -> A {
576
+ bb0(%0 : $*A, %1 : $A, %2 : $A):
577
+ store %1 to %0 : $*A
578
+ %3 = unchecked_addr_cast %0 : $*A to $*A
579
+ %4 = unchecked_addr_cast %3 : $*A to $*A
580
+ br bb1
581
+
582
+ bb1:
583
+ // This means that the first store is not dead.
584
+ %6 = load %3 : $*A
585
+ %7 = load %0 : $*A
586
+ %8 = load %0 : $*A
587
+ %22 = function_ref @use_a : $@convention(thin) (A) -> ()
588
+ %123 = apply %22(%6) : $@convention(thin) (A) -> ()
589
+ %223 = apply %22(%7) : $@convention(thin) (A) -> ()
590
+ %323 = apply %22(%8) : $@convention(thin) (A) -> ()
591
+ store %2 to %0 : $*A
592
+ cond_br undef, bb1, bb2
593
+
594
+ bb2:
595
+ return %7 : $A
596
+ }
597
+
598
+ // CHECK-LABEL: sil @load_to_load_loop
599
+ sil @load_to_load_loop : $@convention(thin) () -> () {
569
600
bb0:
570
601
%101 = alloc_stack $Int32
571
602
%102 = alloc_stack $Int32
@@ -600,32 +631,4 @@ bb2:
600
631
return %9999 : $()
601
632
}
602
633
603
- // Forward store %1 and store %2 such that load %3 becomes an identity trivial cast.
604
- // Both loads from %0 will be eliminated.
605
- // CHECK-LABEL: sil @test_read_dependence_allows_forwarding_multi_bb_2 : $@convention(thin) (@inout A, A, A) -> A {
606
- // CHECK: bb1
607
- // CHECK: load
608
- // CHECK-NOT: load
609
- // CHECK: bb2
610
- sil @test_read_dependence_allows_forwarding_multi_bb_2 : $@convention(thin) (@inout A, A, A) -> A {
611
- bb0(%0 : $*A, %1 : $A, %2 : $A):
612
- store %1 to %0 : $*A
613
- %3 = unchecked_addr_cast %0 : $*A to $*A
614
- %4 = unchecked_addr_cast %3 : $*A to $*A
615
- br bb1
616
634
617
- bb1:
618
- // This means that the first store is not dead.
619
- %6 = load %3 : $*A
620
- %7 = load %0 : $*A
621
- %8 = load %0 : $*A
622
- %22 = function_ref @use_a : $@convention(thin) (A) -> ()
623
- %123 = apply %22(%6) : $@convention(thin) (A) -> ()
624
- %223 = apply %22(%7) : $@convention(thin) (A) -> ()
625
- %323 = apply %22(%8) : $@convention(thin) (A) -> ()
626
- store %2 to %0 : $*A
627
- cond_br undef, bb1, bb2
628
-
629
- bb2:
630
- return %7 : $A
631
- }
0 commit comments