@@ -819,6 +819,43 @@ exit:
819
819
ret void
820
820
}
821
821
822
+ define void @test_guard_assume_and (i32* nocapture readonly %data , i64 %count ) {
823
+ ; CHECK-LABEL: 'test_guard_assume_and'
824
+ ; CHECK-NEXT: Classifying expressions for: @test_guard_assume_and
825
+ ; CHECK-NEXT: %cmp.and = and i1 %cmp.ult, %cmp.ne
826
+ ; CHECK-NEXT: --> (%cmp.ult umin %cmp.ne) U: full-set S: full-set
827
+ ; CHECK-NEXT: %iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
828
+ ; CHECK-NEXT: --> {0,+,1}<nuw><%loop> U: [0,-1) S: [0,-1) Exits: (-1 + %count) LoopDispositions: { %loop: Computable }
829
+ ; CHECK-NEXT: %idx = getelementptr inbounds i32, i32* %data, i64 %iv
830
+ ; CHECK-NEXT: --> {%data,+,4}<%loop> U: full-set S: full-set Exits: (-4 + (4 * %count) + %data) LoopDispositions: { %loop: Computable }
831
+ ; CHECK-NEXT: %iv.next = add nuw i64 %iv, 1
832
+ ; CHECK-NEXT: --> {1,+,1}<nuw><%loop> U: [1,0) S: [1,0) Exits: %count LoopDispositions: { %loop: Computable }
833
+ ; CHECK-NEXT: Determining loop execution counts for: @test_guard_assume_and
834
+ ; CHECK-NEXT: Loop %loop: backedge-taken count is (-1 + %count)
835
+ ; CHECK-NEXT: Loop %loop: max backedge-taken count is -2
836
+ ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-1 + %count)
837
+ ; CHECK-NEXT: Predicates:
838
+ ; CHECK: Loop %loop: Trip multiple is 1
839
+ ;
840
+ entry:
841
+ %cmp.ult = icmp ult i64 %count , 5
842
+ %cmp.ne = icmp ne i64 %count , 0
843
+ %cmp.and = and i1 %cmp.ult , %cmp.ne
844
+ call void @llvm.assume (i1 %cmp.and )
845
+ br label %loop
846
+
847
+ loop:
848
+ %iv = phi i64 [ %iv.next , %loop ], [ 0 , %entry ]
849
+ %idx = getelementptr inbounds i32 , i32* %data , i64 %iv
850
+ store i32 1 , i32* %idx , align 4
851
+ %iv.next = add nuw i64 %iv , 1
852
+ %exitcond.not = icmp eq i64 %iv.next , %count
853
+ br i1 %exitcond.not , label %exit , label %loop
854
+
855
+ exit:
856
+ ret void
857
+ }
858
+
822
859
; Function Attrs: nounwind willreturn
823
860
declare void @llvm.assume (i1 noundef)
824
861
0 commit comments