File: finite-trip-count.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (191 lines) | stat: -rw-r--r-- 6,595 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0  -scalar-evolution-classify-expressions=0  2>&1 | FileCheck %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

declare void @non_exit_use(i32 %i) #0

define void @SLE(i32 %len) willreturn {
; CHECK-LABEL: 'SLE'
; CHECK-NEXT:  Determining loop execution counts for: @SLE
; CHECK-NEXT:  Loop %for.body: backedge-taken count is (0 smax (1 + %len)<nsw>)
; CHECK-NEXT:  Loop %for.body: constant max backedge-taken count is 2147483647
; CHECK-NEXT:  Loop %for.body: symbolic max backedge-taken count is (0 smax (1 + %len)<nsw>)
; CHECK-NEXT:  Loop %for.body: Predicated backedge-taken count is (0 smax (1 + %len)<nsw>)
; CHECK-NEXT:   Predicates:
; CHECK:       Loop %for.body: Trip multiple is 1
;
entry:
  br label %for.body

for.body:
  %iv = phi i32 [ %inc, %for.body ], [ 0, %entry ]
  call void @non_exit_use(i32 %iv) nounwind willreturn
  %inc = add i32 %iv, 1
  %cmp = icmp sle i32 %iv, %len
  br i1 %cmp, label %for.body, label %for.end

for.end:
  ret void
}

define void @SLE_infinite(i32 %len) {
; CHECK-LABEL: 'SLE_infinite'
; CHECK-NEXT:  Determining loop execution counts for: @SLE_infinite
; CHECK-NEXT:  Loop %for.body: Unpredictable backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable constant max backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable symbolic max backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable predicated backedge-taken count.
;
entry:
  br label %for.body

for.body:
  %iv = phi i32 [ %inc, %for.body ], [ 0, %entry ]
  call void @non_exit_use(i32 %iv) nounwind willreturn
  %inc = add i32 %iv, 1
  %cmp = icmp sle i32 %iv, %len
  br i1 %cmp, label %for.body, label %for.end

for.end:
  ret void
}

define void @ULE(i32 %len) willreturn {
; CHECK-LABEL: 'ULE'
; CHECK-NEXT:  Determining loop execution counts for: @ULE
; CHECK-NEXT:  Loop %for.body: backedge-taken count is (1 + %len)<nuw>
; CHECK-NEXT:  Loop %for.body: constant max backedge-taken count is -1
; CHECK-NEXT:  Loop %for.body: symbolic max backedge-taken count is (1 + %len)<nuw>
; CHECK-NEXT:  Loop %for.body: Predicated backedge-taken count is (1 + %len)<nuw>
; CHECK-NEXT:   Predicates:
; CHECK:       Loop %for.body: Trip multiple is 1
;
entry:
  br label %for.body

for.body:
  %iv = phi i32 [ %inc, %for.body ], [ 0, %entry ]
  call void @non_exit_use(i32 %iv) nounwind willreturn
  %inc = add i32 %iv, 1
  %cmp = icmp ule i32 %iv, %len
  br i1 %cmp, label %for.body, label %for.end

for.end:
  ret void
}

define void @ULE_infinite(i32 %len) {
; CHECK-LABEL: 'ULE_infinite'
; CHECK-NEXT:  Determining loop execution counts for: @ULE_infinite
; CHECK-NEXT:  Loop %for.body: Unpredictable backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable constant max backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable symbolic max backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable predicated backedge-taken count.
;
entry:
  br label %for.body

for.body:
  %iv = phi i32 [ %inc, %for.body ], [ 0, %entry ]
  call void @non_exit_use(i32 %iv) nounwind willreturn
  %inc = add i32 %iv, 1
  %cmp = icmp ule i32 %iv, %len
  br i1 %cmp, label %for.body, label %for.end

for.end:
  ret void
}

define void @SGE(i32 %end) willreturn {
; CHECK-LABEL: 'SGE'
; CHECK-NEXT:  Determining loop execution counts for: @SGE
; CHECK-NEXT:  Loop %for.body: backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)<nsw>)))
; CHECK-NEXT:  Loop %for.body: constant max backedge-taken count is -2147483548
; CHECK-NEXT:  Loop %for.body: symbolic max backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)<nsw>)))
; CHECK-NEXT:  Loop %for.body: Predicated backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)<nsw>)))
; CHECK-NEXT:   Predicates:
; CHECK:       Loop %for.body: Trip multiple is 1
;
entry:
  br label %for.body

for.body:
  %iv = phi i32 [ %inc, %for.body ], [ 100, %entry ]
  call void @non_exit_use(i32 %iv) nounwind willreturn
  %inc = add i32 %iv, -1
  %cmp = icmp sge i32 %iv, %end
  br i1 %cmp, label %for.body, label %for.end

for.end:
  ret void
}

define void @SGE_infinite(i32 %end) {
; CHECK-LABEL: 'SGE_infinite'
; CHECK-NEXT:  Determining loop execution counts for: @SGE_infinite
; CHECK-NEXT:  Loop %for.body: Unpredictable backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable constant max backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable symbolic max backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable predicated backedge-taken count.
;
entry:
  br label %for.body

for.body:
  %iv = phi i32 [ %inc, %for.body ], [ 100, %entry ]
  call void @non_exit_use(i32 %iv) nounwind willreturn
  %inc = add i32 %iv, -1
  %cmp = icmp sge i32 %iv, %end
  br i1 %cmp, label %for.body, label %for.end

for.end:
  ret void
}

define void @UGE(i32 %end) willreturn {
; CHECK-LABEL: 'UGE'
; CHECK-NEXT:  Determining loop execution counts for: @UGE
; CHECK-NEXT:  Loop %for.body: backedge-taken count is (100 + (-1 * (100 umin (-1 + %end)))<nsw>)<nsw>
; CHECK-NEXT:  Loop %for.body: constant max backedge-taken count is 100
; CHECK-NEXT:  Loop %for.body: symbolic max backedge-taken count is (100 + (-1 * (100 umin (-1 + %end)))<nsw>)<nsw>
; CHECK-NEXT:  Loop %for.body: Predicated backedge-taken count is (100 + (-1 * (100 umin (-1 + %end)))<nsw>)<nsw>
; CHECK-NEXT:   Predicates:
; CHECK:       Loop %for.body: Trip multiple is 1
;
entry:
  br label %for.body

for.body:
  %iv = phi i32 [ %inc, %for.body ], [ 100, %entry ]
  call void @non_exit_use(i32 %iv) nounwind willreturn
  %inc = add i32 %iv, -1
  %cmp = icmp uge i32 %iv, %end
  br i1 %cmp, label %for.body, label %for.end

for.end:
  ret void
}

define void @UGE_infinite(i32 %end) {
; CHECK-LABEL: 'UGE_infinite'
; CHECK-NEXT:  Determining loop execution counts for: @UGE_infinite
; CHECK-NEXT:  Loop %for.body: Unpredictable backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable constant max backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable symbolic max backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable predicated backedge-taken count.
;
entry:
  br label %for.body

for.body:
  %iv = phi i32 [ %inc, %for.body ], [ 100, %entry ]
  call void @non_exit_use(i32 %iv) nounwind willreturn
  %inc = add i32 %iv, -1
  %cmp = icmp uge i32 %iv, %end
  br i1 %cmp, label %for.body, label %for.end

for.end:
  ret void
}