Skip to content

Commit 4d235bf

Browse files
committed
[tests] Add a couple tests for intersection of ec8d87e and D108651
1 parent 1c829ce commit 4d235bf

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

llvm/test/Analysis/ScalarEvolution/trip-count-implied-addrec.ll

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,24 @@ for.end: ; preds = %for.body, %entry
2727
ret void
2828
}
2929

30+
; CHECK-LABEL: Determining loop execution counts for: @neg_nw_nuw
31+
; CHECK: Loop %for.body: Unpredictable backedge-taken count
32+
; CHECK: Loop %for.body: Unpredictable max backedge-taken count
33+
define void @neg_nw_nuw(i16 %n) mustprogress {
34+
entry:
35+
br label %for.body
36+
37+
for.body: ; preds = %entry, %for.body
38+
%iv = phi i8 [ %iv.next, %for.body ], [ 0, %entry ]
39+
%iv.next = add i8 %iv, -1
40+
%zext = zext i8 %iv to i16
41+
%cmp = icmp ult i16 %zext, %n
42+
br i1 %cmp, label %for.body, label %for.end
43+
44+
for.end: ; preds = %for.body, %entry
45+
ret void
46+
}
47+
3048
; CHECK-LABEL: Determining loop execution counts for: @nw_implies_nsw
3149
; CHECK: Loop %for.body: Unpredictable backedge-taken count
3250
; CHECK: Loop %for.body: Unpredictable max backedge-taken count
@@ -45,6 +63,24 @@ for.end: ; preds = %for.body, %entry
4563
ret void
4664
}
4765

66+
; CHECK-LABEL: Determining loop execution counts for: @neg_nw_nsw
67+
; CHECK: Loop %for.body: Unpredictable backedge-taken count
68+
; CHECK: Loop %for.body: Unpredictable max backedge-taken count
69+
define void @neg_nw_nsw(i16 %n) mustprogress {
70+
entry:
71+
br label %for.body
72+
73+
for.body: ; preds = %entry, %for.body
74+
%iv = phi i8 [ %iv.next, %for.body ], [ -128, %entry ]
75+
%iv.next = add i8 %iv, -1
76+
%zext = sext i8 %iv to i16
77+
%cmp = icmp slt i16 %zext, %n
78+
br i1 %cmp, label %for.body, label %for.end
79+
80+
for.end: ; preds = %for.body, %entry
81+
ret void
82+
}
83+
4884

4985
; CHECK-LABEL: Determining loop execution counts for: @actually_infinite
5086
; CHECK: Loop %for.body: Unpredictable backedge-taken count

0 commit comments

Comments
 (0)