Skip to content

Commit 6b125a2

Browse files
committed
[RLE-DSE] fix a LIT test
1 parent ff72cec commit 6b125a2

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

test/SILPasses/redundantloadelimination.sil

+33-30
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ bb3: // Preds: bb1 bb2
527527
// CHECK-NOT: load
528528
// CHECK: bb3
529529
// CHECK-NOT: load
530-
// CHECK: load
530+
// CHECK: return
531531
sil @load_to_load_irreducible_loop : $@convention(thin) () -> () {
532532
bb0:
533533
%0 = alloc_stack $Int32
@@ -565,7 +565,38 @@ bb3:
565565
return %9999 : $()
566566
}
567567

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) () -> () {
569600
bb0:
570601
%101 = alloc_stack $Int32
571602
%102 = alloc_stack $Int32
@@ -600,32 +631,4 @@ bb2:
600631
return %9999 : $()
601632
}
602633

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
616634

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

Comments
 (0)