File: finite-trip-count.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (175 lines) | stat: -rw-r--r-- 5,281 bytes parent folder | download | duplicates (4)
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
; 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: max backedge-taken count is 2147483647
; CHECK-NEXT:  Loop %for.body: Predicated backedge-taken count is (0 smax (1 + %len)<nsw>)
; CHECK-NEXT:   Predicates:
;
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 max 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: max backedge-taken count is -1
; CHECK-NEXT:  Loop %for.body: Predicated backedge-taken count is (1 + %len)<nuw>
; CHECK-NEXT:   Predicates:
;
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 max 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: max backedge-taken count is -2147483548
; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (100 + (-1 * (100 smin (-1 + %end)<nsw>)))
; CHECK-NEXT:   Predicates:
;
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 max 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: max backedge-taken count is 100
; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is (100 + (-1 * (100 umin (-1 + %end)))<nsw>)<nsw>
; CHECK-NEXT:   Predicates:
;
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 max 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
}