@@ -786,3 +786,134 @@ define void @test16_caller(i32* %p, i32 %c) {
786
786
tail call void @test16_sub (i32* %p , i32 %c , i32 %c )
787
787
ret void
788
788
}
789
+
790
+ ; test 17
791
+ ;
792
+ ; only_store is not called after make_alias is called.
793
+ ;
794
+ ; void test17_caller(int* p, int c) {
795
+ ; if(c) {
796
+ ; make_alias(p);
797
+ ; if(0 == 0) {
798
+ ; goto l3;
799
+ ; } else {
800
+ ; goto l2;
801
+ ; }
802
+ ; }
803
+ ; l2:
804
+ ; only_store(p);
805
+ ; l3:
806
+ ; return;
807
+ ; }
808
+
809
+ define void @test17_caller (i32* noalias %p , i32 %c ) {
810
+ ; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn writeonly
811
+ ; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@test17_caller
812
+ ; NOT_CGSCC_NPM-SAME: (i32* noalias nofree writeonly [[P:%.*]], i32 [[C:%.*]])
813
+ ; NOT_CGSCC_NPM-NEXT: entry:
814
+ ; NOT_CGSCC_NPM-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
815
+ ; NOT_CGSCC_NPM-NEXT: br i1 [[TOBOOL]], label [[L1:%.*]], label [[L2:%.*]]
816
+ ; NOT_CGSCC_NPM: l1:
817
+ ; NOT_CGSCC_NPM-NEXT: tail call void @make_alias(i32* nofree writeonly [[P]])
818
+ ; NOT_CGSCC_NPM-NEXT: br label [[L3:%.*]]
819
+ ; NOT_CGSCC_NPM: l2:
820
+ ; NOT_CGSCC_NPM-NEXT: tail call void @only_store(i32* nocapture nofree writeonly align 4 [[P]])
821
+ ; NOT_CGSCC_NPM-NEXT: br label [[L3]]
822
+ ; NOT_CGSCC_NPM: l3:
823
+ ; NOT_CGSCC_NPM-NEXT: ret void
824
+ ;
825
+ ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
826
+ ; IS__CGSCC____-LABEL: define {{[^@]+}}@test17_caller
827
+ ; IS__CGSCC____-SAME: (i32* noalias nofree writeonly [[P:%.*]], i32 [[C:%.*]])
828
+ ; IS__CGSCC____-NEXT: entry:
829
+ ; IS__CGSCC____-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
830
+ ; IS__CGSCC____-NEXT: br i1 [[TOBOOL]], label [[L1:%.*]], label [[L2:%.*]]
831
+ ; IS__CGSCC____: l1:
832
+ ; IS__CGSCC____-NEXT: tail call void @make_alias(i32* nofree writeonly [[P]])
833
+ ; IS__CGSCC____-NEXT: br label [[L3:%.*]]
834
+ ; IS__CGSCC____: l2:
835
+ ; IS__CGSCC____-NEXT: tail call void @only_store(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(4) [[P]])
836
+ ; IS__CGSCC____-NEXT: br label [[L3]]
837
+ ; IS__CGSCC____: l3:
838
+ ; IS__CGSCC____-NEXT: ret void
839
+ ;
840
+ entry:
841
+ %tobool = icmp eq i32 %c , 0
842
+ br i1 %tobool , label %l1 , label %l2
843
+
844
+ l1:
845
+ tail call void @make_alias (i32* %p )
846
+ %tobool2 = icmp eq i32 0 , 0
847
+ br i1 %tobool2 , label %l3 , label %l2
848
+
849
+ l2:
850
+ tail call void @only_store (i32* %p )
851
+ br label %l3
852
+
853
+ l3:
854
+ ret void
855
+ }
856
+
857
+ ; test 18
858
+ ; void test18_caller(int* p, int c) {
859
+ ; if(c) {
860
+ ; make_alias(p);
861
+ ; noreturn();
862
+ ; }
863
+ ; only_store(p);
864
+ ; return;
865
+ ; }
866
+
867
+ define void @noreturn () {
868
+ ; NOT_CGSCC_NPM: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
869
+ ; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@noreturn()
870
+ ; NOT_CGSCC_NPM-NEXT: unreachable
871
+ ;
872
+ ; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
873
+ ; IS__CGSCC____-LABEL: define {{[^@]+}}@noreturn()
874
+ ; IS__CGSCC____-NEXT: unreachable
875
+ ;
876
+ call void @noreturn ()
877
+ ret void
878
+ }
879
+
880
+ define void @test18_caller (i32* noalias %p , i32 %c ) {
881
+ ; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn writeonly
882
+ ; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@test18_caller
883
+ ; NOT_CGSCC_NPM-SAME: (i32* noalias nofree writeonly [[P:%.*]], i32 [[C:%.*]])
884
+ ; NOT_CGSCC_NPM-NEXT: entry:
885
+ ; NOT_CGSCC_NPM-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
886
+ ; NOT_CGSCC_NPM-NEXT: br i1 [[TOBOOL]], label [[L1:%.*]], label [[L2:%.*]]
887
+ ; NOT_CGSCC_NPM: l1:
888
+ ; NOT_CGSCC_NPM-NEXT: tail call void @make_alias(i32* nofree writeonly [[P]])
889
+ ; NOT_CGSCC_NPM-NEXT: unreachable
890
+ ; NOT_CGSCC_NPM: l2:
891
+ ; NOT_CGSCC_NPM-NEXT: tail call void @only_store(i32* nocapture nofree writeonly align 4 [[P]])
892
+ ; NOT_CGSCC_NPM-NEXT: ret void
893
+ ;
894
+ ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
895
+ ; IS__CGSCC____-LABEL: define {{[^@]+}}@test18_caller
896
+ ; IS__CGSCC____-SAME: (i32* noalias nofree nonnull writeonly align 4 dereferenceable(4) [[P:%.*]], i32 [[C:%.*]])
897
+ ; IS__CGSCC____-NEXT: entry:
898
+ ; IS__CGSCC____-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[C]], 0
899
+ ; IS__CGSCC____-NEXT: br i1 [[TOBOOL]], label [[L1:%.*]], label [[L2:%.*]]
900
+ ; IS__CGSCC____: l1:
901
+ ; IS__CGSCC____-NEXT: tail call void @make_alias(i32* nofree nonnull writeonly align 4 dereferenceable(4) [[P]])
902
+ ; IS__CGSCC____-NEXT: unreachable
903
+ ; IS__CGSCC____: l2:
904
+ ; IS__CGSCC____-NEXT: tail call void @only_store(i32* nocapture nofree nonnull writeonly align 4 dereferenceable(4) [[P]])
905
+ ; IS__CGSCC____-NEXT: ret void
906
+ ;
907
+ entry:
908
+ %tobool = icmp eq i32 %c , 0
909
+ br i1 %tobool , label %l1 , label %l2
910
+
911
+ l1:
912
+ tail call void @make_alias (i32* %p )
913
+ tail call void @noreturn ()
914
+ br label %l2
915
+
916
+ l2:
917
+ tail call void @only_store (i32* %p )
918
+ ret void
919
+ }
0 commit comments