@@ -16,7 +16,14 @@ struct NativeObjectPair {
16
16
var y: Builtin.NativeObject
17
17
}
18
18
19
+ struct IntPair {
20
+ var x: Builtin.Int32
21
+ var y: Builtin.Int32
22
+ }
23
+
19
24
sil @guaranteed_object_user : $@convention(thin) (@guaranteed Builtin.NativeObject) -> ()
25
+ sil @intpair_user : $@convention(thin) (IntPair) -> ()
26
+ sil @inout_int32_user : $@convention(thin) (@inout Builtin.Int32) -> ()
20
27
21
28
/// Needed to avoid tuple scalarization code in the use gatherer.
22
29
struct NativeObjectAndTuple {
@@ -686,3 +693,131 @@ bb0(%0 : @owned $Builtin.NativeObject, %1 : @owned $Builtin.NativeObject):
686
693
%9999 = tuple()
687
694
return %9999 : $()
688
695
}
696
+
697
+ // CHECK-LABEL: sil [ossa] @multiple_available_values_diamond_followed_by_loop_trivial : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> () {
698
+ // CHECK: bb0(
699
+ // CHECK-NOT: load [trivial] %{{[0-9][0-9]*}} : $*IntPair
700
+ // CHECK-NOT: bb{{[0-9][0-9]*}}(
701
+ // CHECK: } // end sil function 'multiple_available_values_diamond_followed_by_loop_trivial'
702
+ sil [ossa] @multiple_available_values_diamond_followed_by_loop_trivial : $@convention(thin) (Builtin.Int32, Builtin.Int32) -> () {
703
+ bb0(%0a : $Builtin.Int32, %0b : $Builtin.Int32):
704
+ %func = function_ref @intpair_user : $@convention(thin) (IntPair) -> ()
705
+ %1 = alloc_stack $IntPair
706
+ %1a = struct_element_addr %1 : $*IntPair, #IntPair.x
707
+ %1b = struct_element_addr %1 : $*IntPair, #IntPair.y
708
+ cond_br undef, bb1, bb2
709
+
710
+ bb1:
711
+ store %0a to [trivial] %1a : $*Builtin.Int32
712
+ store %0b to [trivial] %1b : $*Builtin.Int32
713
+ br bb3
714
+
715
+ bb2:
716
+ store %0a to [trivial] %1a : $*Builtin.Int32
717
+ store %0b to [trivial] %1b : $*Builtin.Int32
718
+ br bb3
719
+
720
+ bb3:
721
+ br bb4
722
+
723
+ bb4:
724
+ br bb5
725
+
726
+ bb5:
727
+ %2 = load [trivial] %1 : $*IntPair
728
+ cond_br undef, bb6, bb7
729
+
730
+ bb6:
731
+ apply %func(%2) : $@convention(thin) (IntPair) -> ()
732
+ br bb5
733
+
734
+ bb7:
735
+ apply %func(%2) : $@convention(thin) (IntPair) -> ()
736
+ dealloc_stack %1 : $*IntPair
737
+ %9999 = tuple()
738
+ return %9999 : $()
739
+ }
740
+
741
+ // CHECK-LABEL: sil [ossa] @multiple_available_values_diamond_followed_by_loop_trivial_reload : $@convention(thin) (Builtin.Int32, Builtin.Int32, Builtin.Int32) -> () {
742
+ // CHECK: bb0(
743
+ // CHECK-NOT: load [trivial] %{{[0-9][0-9]*}} : $*IntPair
744
+ // CHECK-NOT: bb{{[0-9][0-9]*}}(
745
+ // CHECK: } // end sil function 'multiple_available_values_diamond_followed_by_loop_trivial_reload'
746
+ sil [ossa] @multiple_available_values_diamond_followed_by_loop_trivial_reload : $@convention(thin) (Builtin.Int32, Builtin.Int32, Builtin.Int32) -> () {
747
+ bb0(%0a : $Builtin.Int32, %0b : $Builtin.Int32, %0c : $Builtin.Int32):
748
+ %func = function_ref @intpair_user : $@convention(thin) (IntPair) -> ()
749
+ %1 = alloc_stack $IntPair
750
+ %1a = struct_element_addr %1 : $*IntPair, #IntPair.x
751
+ %1b = struct_element_addr %1 : $*IntPair, #IntPair.y
752
+ cond_br undef, bb1, bb2
753
+
754
+ bb1:
755
+ store %0a to [trivial] %1a : $*Builtin.Int32
756
+ store %0c to [trivial] %1b : $*Builtin.Int32
757
+ br bb3
758
+
759
+ bb2:
760
+ store %0a to [trivial] %1a : $*Builtin.Int32
761
+ store %0b to [trivial] %1b : $*Builtin.Int32
762
+ br bb3
763
+
764
+ bb3:
765
+ br bb4
766
+
767
+ bb4:
768
+ br bb5
769
+
770
+ bb5:
771
+ %2 = load [trivial] %1 : $*IntPair
772
+ cond_br undef, bb6, bb7
773
+
774
+ bb6:
775
+ apply %func(%2) : $@convention(thin) (IntPair) -> ()
776
+ br bb5
777
+
778
+ bb7:
779
+ apply %func(%2) : $@convention(thin) (IntPair) -> ()
780
+ dealloc_stack %1 : $*IntPair
781
+ %9999 = tuple()
782
+ return %9999 : $()
783
+ }
784
+
785
+ sil [ossa] @multiple_available_values_diamond_followed_by_loop_trivial_store_in_loop : $@convention(thin) (Builtin.Int32, Builtin.Int32, Builtin.Int32) -> () {
786
+ bb0(%0a : $Builtin.Int32, %0b : $Builtin.Int32, %0c : $Builtin.Int32):
787
+ %func = function_ref @intpair_user : $@convention(thin) (IntPair) -> ()
788
+ %1 = alloc_stack $IntPair
789
+ %1a = struct_element_addr %1 : $*IntPair, #IntPair.x
790
+ %1b = struct_element_addr %1 : $*IntPair, #IntPair.y
791
+ cond_br undef, bb1, bb2
792
+
793
+ bb1:
794
+ store %0a to [trivial] %1a : $*Builtin.Int32
795
+ store %0b to [trivial] %1b : $*Builtin.Int32
796
+ br bb3
797
+
798
+ bb2:
799
+ store %0a to [trivial] %1a : $*Builtin.Int32
800
+ store %0b to [trivial] %1b : $*Builtin.Int32
801
+ br bb3
802
+
803
+ bb3:
804
+ br bb4
805
+
806
+ bb4:
807
+ br bb5
808
+
809
+ bb5:
810
+ %2 = load [trivial] %1 : $*IntPair
811
+ cond_br undef, bb6, bb7
812
+
813
+ bb6:
814
+ apply %func(%2) : $@convention(thin) (IntPair) -> ()
815
+ store %0b to [trivial] %1b : $*Builtin.Int32
816
+ br bb5
817
+
818
+ bb7:
819
+ apply %func(%2) : $@convention(thin) (IntPair) -> ()
820
+ dealloc_stack %1 : $*IntPair
821
+ %9999 = tuple()
822
+ return %9999 : $()
823
+ }
0 commit comments