@@ -636,17 +636,16 @@ exit:
636
636
ret i32 %outval
637
637
}
638
638
639
- ; Merging the icmps with logic-op defeats the purpose of the metadata.
639
+ ; FIXME: Merging the icmps with logic-op defeats the purpose of the metadata.
640
640
; We can't tell which condition is expensive if they are combined.
641
641
642
642
define void @or_icmps_harmful (i32 %x , i32 %y , i8* %p ) {
643
643
; CHECK-LABEL: @or_icmps_harmful(
644
644
; CHECK-NEXT: entry:
645
645
; CHECK-NEXT: [[EXPECTED_TRUE:%.*]] = icmp sgt i32 [[X:%.*]], -1
646
- ; CHECK-NEXT: br i1 [[EXPECTED_TRUE]], label [[EXIT:%.*]], label [[RARE:%.*]], !prof !19
647
- ; CHECK: rare:
648
646
; CHECK-NEXT: [[EXPENSIVE:%.*]] = icmp eq i32 [[Y:%.*]], 0
649
- ; CHECK-NEXT: br i1 [[EXPENSIVE]], label [[EXIT]], label [[FALSE:%.*]]
647
+ ; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[EXPECTED_TRUE]], [[EXPENSIVE]]
648
+ ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !19
650
649
; CHECK: false:
651
650
; CHECK-NEXT: store i8 42, i8* [[P:%.*]], align 1
652
651
; CHECK-NEXT: br label [[EXIT]]
@@ -669,17 +668,16 @@ exit:
669
668
ret void
670
669
}
671
670
672
- ; Merging the icmps with logic-op defeats the purpose of the metadata.
671
+ ; FIXME: Merging the icmps with logic-op defeats the purpose of the metadata.
673
672
; We can't tell which condition is expensive if they are combined.
674
673
675
674
define void @or_icmps_harmful_inverted (i32 %x , i32 %y , i8* %p ) {
676
675
; CHECK-LABEL: @or_icmps_harmful_inverted(
677
676
; CHECK-NEXT: entry:
678
- ; CHECK-NEXT: [[EXPECTED_FALSE:%.*]] = icmp sgt i32 [[X:%.*]], -1
679
- ; CHECK-NEXT: br i1 [[EXPECTED_FALSE]], label [[RARE:%.*]], label [[EXIT:%.*]], !prof !20
680
- ; CHECK: rare:
677
+ ; CHECK-NEXT: [[EXPECTED_FALSE:%.*]] = icmp sle i32 [[X:%.*]], -1
681
678
; CHECK-NEXT: [[EXPENSIVE:%.*]] = icmp eq i32 [[Y:%.*]], 0
682
- ; CHECK-NEXT: br i1 [[EXPENSIVE]], label [[EXIT]], label [[FALSE:%.*]]
679
+ ; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[EXPECTED_FALSE]], [[EXPENSIVE]]
680
+ ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !19
683
681
; CHECK: false:
684
682
; CHECK-NEXT: store i8 42, i8* [[P:%.*]], align 1
685
683
; CHECK-NEXT: br label [[EXIT]]
@@ -702,16 +700,15 @@ exit:
702
700
ret void
703
701
}
704
702
705
- ; The probability threshold is determined by a TTI setting.
706
- ; In this example, we are just short of strongly expected, so speculate.
703
+ ; The probability threshold is set by a builtin_expect setting.
707
704
708
705
define void @or_icmps_not_that_harmful (i32 %x , i32 %y , i8* %p ) {
709
706
; CHECK-LABEL: @or_icmps_not_that_harmful(
710
707
; CHECK-NEXT: entry:
711
708
; CHECK-NEXT: [[EXPECTED_TRUE:%.*]] = icmp sgt i32 [[X:%.*]], -1
712
709
; CHECK-NEXT: [[EXPENSIVE:%.*]] = icmp eq i32 [[Y:%.*]], 0
713
710
; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[EXPECTED_TRUE]], [[EXPENSIVE]]
714
- ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !21
711
+ ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !20
715
712
; CHECK: false:
716
713
; CHECK-NEXT: store i8 42, i8* [[P:%.*]], align 1
717
714
; CHECK-NEXT: br label [[EXIT]]
@@ -734,16 +731,13 @@ exit:
734
731
ret void
735
732
}
736
733
737
- ; The probability threshold is determined by a TTI setting.
738
- ; In this example, we are just short of strongly expected, so speculate.
739
-
740
734
define void @or_icmps_not_that_harmful_inverted (i32 %x , i32 %y , i8* %p ) {
741
735
; CHECK-LABEL: @or_icmps_not_that_harmful_inverted(
742
736
; CHECK-NEXT: entry:
743
737
; CHECK-NEXT: [[EXPECTED_TRUE:%.*]] = icmp sgt i32 [[X:%.*]], -1
744
738
; CHECK-NEXT: [[EXPENSIVE:%.*]] = icmp eq i32 [[Y:%.*]], 0
745
739
; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[EXPECTED_TRUE]], [[EXPENSIVE]]
746
- ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !22
740
+ ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !21
747
741
; CHECK: false:
748
742
; CHECK-NEXT: store i8 42, i8* [[P:%.*]], align 1
749
743
; CHECK-NEXT: br label [[EXIT]]
@@ -766,15 +760,13 @@ exit:
766
760
ret void
767
761
}
768
762
769
- ; The 1st cmp is probably true, so speculating the 2nd is probably a win.
770
-
771
763
define void @or_icmps_useful (i32 %x , i32 %y , i8* %p ) {
772
764
; CHECK-LABEL: @or_icmps_useful(
773
765
; CHECK-NEXT: entry:
774
766
; CHECK-NEXT: [[EXPECTED_TRUE:%.*]] = icmp sle i32 [[X:%.*]], -1
775
767
; CHECK-NEXT: [[EXPENSIVE:%.*]] = icmp eq i32 [[Y:%.*]], 0
776
768
; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[EXPECTED_TRUE]], [[EXPENSIVE]]
777
- ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !23
769
+ ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !22
778
770
; CHECK: false:
779
771
; CHECK-NEXT: store i8 42, i8* [[P:%.*]], align 1
780
772
; CHECK-NEXT: br label [[EXIT]]
@@ -797,15 +789,13 @@ exit:
797
789
ret void
798
790
}
799
791
800
- ; The 1st cmp is probably false, so speculating the 2nd is probably a win.
801
-
802
792
define void @or_icmps_useful_inverted (i32 %x , i32 %y , i8* %p ) {
803
793
; CHECK-LABEL: @or_icmps_useful_inverted(
804
794
; CHECK-NEXT: entry:
805
795
; CHECK-NEXT: [[EXPECTED_FALSE:%.*]] = icmp sgt i32 [[X:%.*]], -1
806
796
; CHECK-NEXT: [[EXPENSIVE:%.*]] = icmp eq i32 [[Y:%.*]], 0
807
797
; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[EXPECTED_FALSE]], [[EXPENSIVE]]
808
- ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !23
798
+ ; CHECK-NEXT: br i1 [[OR_COND]], label [[EXIT:%.*]], label [[FALSE:%.*]], !prof !22
809
799
; CHECK: false:
810
800
; CHECK-NEXT: store i8 42, i8* [[P:%.*]], align 1
811
801
; CHECK-NEXT: br label [[EXIT]]
@@ -859,17 +849,16 @@ exit:
859
849
ret void
860
850
}
861
851
862
- ; Merging the icmps with logic-op defeats the purpose of the metadata.
852
+ ; FIXME: Merging the icmps with logic-op defeats the purpose of the metadata.
863
853
; We can't tell which condition is expensive if they are combined.
864
854
865
855
define void @and_icmps_harmful (i32 %x , i32 %y , i8* %p ) {
866
856
; CHECK-LABEL: @and_icmps_harmful(
867
857
; CHECK-NEXT: entry:
868
858
; CHECK-NEXT: [[EXPECTED_FALSE:%.*]] = icmp sgt i32 [[X:%.*]], -1
869
- ; CHECK-NEXT: br i1 [[EXPECTED_FALSE]], label [[RARE:%.*]], label [[EXIT:%.*]], !prof !20
870
- ; CHECK: rare:
871
859
; CHECK-NEXT: [[EXPENSIVE:%.*]] = icmp eq i32 [[Y:%.*]], 0
872
- ; CHECK-NEXT: br i1 [[EXPENSIVE]], label [[FALSE:%.*]], label [[EXIT]]
860
+ ; CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[EXPECTED_FALSE]], [[EXPENSIVE]]
861
+ ; CHECK-NEXT: br i1 [[OR_COND]], label [[FALSE:%.*]], label [[EXIT:%.*]], !prof !23
873
862
; CHECK: false:
874
863
; CHECK-NEXT: store i8 42, i8* [[P:%.*]], align 1
875
864
; CHECK-NEXT: br label [[EXIT]]
@@ -892,17 +881,16 @@ exit:
892
881
ret void
893
882
}
894
883
895
- ; Merging the icmps with logic-op defeats the purpose of the metadata.
884
+ ; FIXME: Merging the icmps with logic-op defeats the purpose of the metadata.
896
885
; We can't tell which condition is expensive if they are combined.
897
886
898
887
define void @and_icmps_harmful_inverted (i32 %x , i32 %y , i8* %p ) {
899
888
; CHECK-LABEL: @and_icmps_harmful_inverted(
900
889
; CHECK-NEXT: entry:
901
- ; CHECK-NEXT: [[EXPECTED_TRUE:%.*]] = icmp sgt i32 [[X:%.*]], -1
902
- ; CHECK-NEXT: br i1 [[EXPECTED_TRUE]], label [[EXIT:%.*]], label [[RARE:%.*]], !prof !19
903
- ; CHECK: rare:
890
+ ; CHECK-NEXT: [[EXPECTED_TRUE:%.*]] = icmp sle i32 [[X:%.*]], -1
904
891
; CHECK-NEXT: [[EXPENSIVE:%.*]] = icmp eq i32 [[Y:%.*]], 0
905
- ; CHECK-NEXT: br i1 [[EXPENSIVE]], label [[FALSE:%.*]], label [[EXIT]]
892
+ ; CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[EXPECTED_TRUE]], [[EXPENSIVE]]
893
+ ; CHECK-NEXT: br i1 [[OR_COND]], label [[FALSE:%.*]], label [[EXIT:%.*]], !prof !23
906
894
; CHECK: false:
907
895
; CHECK-NEXT: store i8 42, i8* [[P:%.*]], align 1
908
896
; CHECK-NEXT: br label [[EXIT]]
@@ -925,9 +913,6 @@ exit:
925
913
ret void
926
914
}
927
915
928
- ; The probability threshold is determined by a TTI setting.
929
- ; In this example, we are just short of strongly expected, so speculate.
930
-
931
916
define void @and_icmps_not_that_harmful (i32 %x , i32 %y , i8* %p ) {
932
917
; CHECK-LABEL: @and_icmps_not_that_harmful(
933
918
; CHECK-NEXT: entry:
@@ -957,9 +942,6 @@ exit:
957
942
ret void
958
943
}
959
944
960
- ; The probability threshold is determined by a TTI setting.
961
- ; In this example, we are just short of strongly expected, so speculate.
962
-
963
945
define void @and_icmps_not_that_harmful_inverted (i32 %x , i32 %y , i8* %p ) {
964
946
; CHECK-LABEL: @and_icmps_not_that_harmful_inverted(
965
947
; CHECK-NEXT: entry:
@@ -989,8 +971,6 @@ exit:
989
971
ret void
990
972
}
991
973
992
- ; The 1st cmp is probably true, so speculating the 2nd is probably a win.
993
-
994
974
define void @and_icmps_useful (i32 %x , i32 %y , i8* %p ) {
995
975
; CHECK-LABEL: @and_icmps_useful(
996
976
; CHECK-NEXT: entry:
@@ -1020,8 +1000,6 @@ exit:
1020
1000
ret void
1021
1001
}
1022
1002
1023
- ; The 1st cmp is probably false, so speculating the 2nd is probably a win.
1024
-
1025
1003
define void @and_icmps_useful_inverted (i32 %x , i32 %y , i8* %p ) {
1026
1004
; CHECK-LABEL: @and_icmps_useful_inverted(
1027
1005
; CHECK-NEXT: entry:
0 commit comments