llvm.org GIT mirror llvm / 48617a9
[LFTR] Regenerate test checks; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365262 91177308-0d34-0410-b5e6-96231b3b80d8 Nikita Popov 2 months ago
2 changed file(s) with 353 addition(s) and 223 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt < %s -indvars -S | FileCheck %s
2
3 ; Provide legal integer types.
4 target datalayout = "n8:16:32:64"
5
6
7 @a = common global i32 0, align 4
8 @c = common global i32 0, align 4
9 @b = common global i32 0, align 4
10
11 define void @f() {
12 ; CHECK-LABEL: @f(
13 ; CHECK-NEXT: entry:
14 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* @a, align 4
15 ; CHECK-NEXT: [[TOBOOL2:%.*]] = icmp eq i32 [[TMP0]], 0
16 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* @a, align 4
17 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP1]], 0
18 ; CHECK-NEXT: br label [[FOR_COND2_PREHEADER:%.*]]
19 ; CHECK: for.cond2.preheader:
20 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i32 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC13:%.*]] ], [ -14, [[ENTRY:%.*]] ]
21 ; CHECK-NEXT: br i1 [[TOBOOL2]], label [[FOR_INC13]], label [[FOR_BODY3_LR_PH:%.*]]
22 ; CHECK: for.body3.lr.ph:
23 ; CHECK-NEXT: [[TMP2:%.*]] = add nsw i32 [[INDVARS_IV]], 1
24 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ult i32 [[TMP2]], 3
25 ; CHECK-NEXT: [[DIV:%.*]] = select i1 [[TMP3]], i32 [[INDVARS_IV]], i32 0
26 ; CHECK-NEXT: br i1 false, label [[FOR_BODY3_LR_PH_SPLIT_US:%.*]], label [[FOR_BODY3_LR_PH_FOR_BODY3_LR_PH_SPLIT_CRIT_EDGE:%.*]]
27 ; CHECK: for.body3.lr.ph.for.body3.lr.ph.split_crit_edge:
28 ; CHECK-NEXT: br label [[FOR_BODY3_LR_PH_SPLIT:%.*]]
29 ; CHECK: for.body3.lr.ph.split.us:
30 ; CHECK-NEXT: br i1 [[TOBOOL]], label [[FOR_BODY3_LR_PH_SPLIT_US_SPLIT_US:%.*]], label [[FOR_BODY3_LR_PH_SPLIT_US_FOR_BODY3_LR_PH_SPLIT_US_SPLIT_CRIT_EDGE:%.*]]
31 ; CHECK: for.body3.lr.ph.split.us.for.body3.lr.ph.split.us.split_crit_edge:
32 ; CHECK-NEXT: br label [[FOR_BODY3_LR_PH_SPLIT_US_SPLIT:%.*]]
33 ; CHECK: for.body3.lr.ph.split.us.split.us:
34 ; CHECK-NEXT: br label [[FOR_BODY3_US_US:%.*]]
35 ; CHECK: for.body3.us.us:
36 ; CHECK-NEXT: br i1 true, label [[COND_FALSE_US_US:%.*]], label [[COND_END_US_US:%.*]]
37 ; CHECK: cond.false.us.us:
38 ; CHECK-NEXT: br label [[COND_END_US_US]]
39 ; CHECK: cond.end.us.us:
40 ; CHECK-NEXT: [[TMP4:%.*]] = load i32, i32* @b, align 4
41 ; CHECK-NEXT: [[CMP91_US_US:%.*]] = icmp slt i32 [[TMP4]], 1
42 ; CHECK-NEXT: br i1 [[CMP91_US_US]], label [[FOR_INC_LR_PH_US_US:%.*]], label [[FOR_COND2_LOOPEXIT_US_US:%.*]]
43 ; CHECK: for.cond2.loopexit.us.us:
44 ; CHECK-NEXT: br i1 true, label [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US_US_LCSSA_US:%.*]], label [[FOR_BODY3_US_US]]
45 ; CHECK: for.inc.lr.ph.us.us:
46 ; CHECK-NEXT: br label [[FOR_INC_US_US:%.*]]
47 ; CHECK: for.cond8.for.cond2.loopexit_crit_edge.us.us:
48 ; CHECK-NEXT: store i32 1, i32* @b, align 4
49 ; CHECK-NEXT: br label [[FOR_COND2_LOOPEXIT_US_US]]
50 ; CHECK: for.inc.us.us:
51 ; CHECK-NEXT: [[TMP5:%.*]] = phi i32 [ [[TMP4]], [[FOR_INC_LR_PH_US_US]] ], [ [[INC_US_US:%.*]], [[FOR_INC_US_US]] ]
52 ; CHECK-NEXT: [[INC_US_US]] = add nsw i32 [[TMP5]], 1
53 ; CHECK-NEXT: [[EXITCOND3:%.*]] = icmp ne i32 [[INC_US_US]], 1
54 ; CHECK-NEXT: br i1 [[EXITCOND3]], label [[FOR_INC_US_US]], label [[FOR_COND8_FOR_COND2_LOOPEXIT_CRIT_EDGE_US_US:%.*]]
55 ; CHECK: for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa.us:
56 ; CHECK-NEXT: br label [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US:%.*]]
57 ; CHECK: for.body3.lr.ph.split.us.split:
58 ; CHECK-NEXT: br label [[FOR_BODY3_US:%.*]]
59 ; CHECK: for.body3.us:
60 ; CHECK-NEXT: br i1 true, label [[COND_FALSE_US:%.*]], label [[COND_END_US:%.*]]
61 ; CHECK: cond.false.us:
62 ; CHECK-NEXT: br label [[COND_END_US]]
63 ; CHECK: cond.end.us:
64 ; CHECK-NEXT: [[COND_US:%.*]] = phi i32 [ [[DIV]], [[COND_FALSE_US]] ], [ [[INDVARS_IV]], [[FOR_BODY3_US]] ]
65 ; CHECK-NEXT: [[TMP6:%.*]] = load i32, i32* @b, align 4
66 ; CHECK-NEXT: [[CMP91_US:%.*]] = icmp slt i32 [[TMP6]], 1
67 ; CHECK-NEXT: br i1 [[CMP91_US]], label [[FOR_INC_LR_PH_US:%.*]], label [[FOR_COND2_LOOPEXIT_US:%.*]]
68 ; CHECK: for.inc.us:
69 ; CHECK-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP6]], [[FOR_INC_LR_PH_US]] ], [ [[INC_US:%.*]], [[FOR_INC_US:%.*]] ]
70 ; CHECK-NEXT: [[INC_US]] = add nsw i32 [[TMP7]], 1
71 ; CHECK-NEXT: [[EXITCOND2:%.*]] = icmp ne i32 [[INC_US]], 1
72 ; CHECK-NEXT: br i1 [[EXITCOND2]], label [[FOR_INC_US]], label [[FOR_COND8_FOR_COND2_LOOPEXIT_CRIT_EDGE_US:%.*]]
73 ; CHECK: for.cond2.loopexit.us:
74 ; CHECK-NEXT: br i1 false, label [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US_US_LCSSA:%.*]], label [[FOR_BODY3_US]]
75 ; CHECK: for.inc.lr.ph.us:
76 ; CHECK-NEXT: br label [[FOR_INC_US]]
77 ; CHECK: for.cond8.for.cond2.loopexit_crit_edge.us:
78 ; CHECK-NEXT: store i32 1, i32* @b, align 4
79 ; CHECK-NEXT: br label [[FOR_COND2_LOOPEXIT_US]]
80 ; CHECK: for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa:
81 ; CHECK-NEXT: [[COND_LCSSA_PH_US_PH:%.*]] = phi i32 [ [[COND_US]], [[FOR_COND2_LOOPEXIT_US]] ]
82 ; CHECK-NEXT: br label [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US]]
83 ; CHECK: for.cond2.for.inc13_crit_edge.us-lcssa.us:
84 ; CHECK-NEXT: [[COND_LCSSA_PH_US:%.*]] = phi i32 [ [[COND_LCSSA_PH_US_PH]], [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US_US_LCSSA]] ], [ [[DIV]], [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US_US_LCSSA_US]] ]
85 ; CHECK-NEXT: br label [[FOR_COND2_FOR_INC13_CRIT_EDGE:%.*]]
86 ; CHECK: for.body3.lr.ph.split:
87 ; CHECK-NEXT: br i1 [[TOBOOL]], label [[FOR_BODY3_LR_PH_SPLIT_SPLIT_US:%.*]], label [[FOR_BODY3_LR_PH_SPLIT_FOR_BODY3_LR_PH_SPLIT_SPLIT_CRIT_EDGE:%.*]]
88 ; CHECK: for.body3.lr.ph.split.for.body3.lr.ph.split.split_crit_edge:
89 ; CHECK-NEXT: br label [[FOR_BODY3_LR_PH_SPLIT_SPLIT:%.*]]
90 ; CHECK: for.body3.lr.ph.split.split.us:
91 ; CHECK-NEXT: br label [[FOR_BODY3_US3:%.*]]
92 ; CHECK: for.body3.us3:
93 ; CHECK-NEXT: br i1 false, label [[COND_FALSE_US4:%.*]], label [[COND_END_US5:%.*]]
94 ; CHECK: cond.false.us4:
95 ; CHECK-NEXT: br label [[COND_END_US5]]
96 ; CHECK: cond.end.us5:
97 ; CHECK-NEXT: [[TMP8:%.*]] = load i32, i32* @b, align 4
98 ; CHECK-NEXT: [[CMP91_US7:%.*]] = icmp slt i32 [[TMP8]], 1
99 ; CHECK-NEXT: br i1 [[CMP91_US7]], label [[FOR_INC_LR_PH_US12:%.*]], label [[FOR_COND2_LOOPEXIT_US11:%.*]]
100 ; CHECK: for.inc.us8:
101 ; CHECK-NEXT: [[TMP9:%.*]] = phi i32 [ [[TMP8]], [[FOR_INC_LR_PH_US12]] ], [ [[INC_US9:%.*]], [[FOR_INC_US8:%.*]] ]
102 ; CHECK-NEXT: [[INC_US9]] = add nsw i32 [[TMP9]], 1
103 ; CHECK-NEXT: [[EXITCOND1:%.*]] = icmp ne i32 [[INC_US9]], 1
104 ; CHECK-NEXT: br i1 [[EXITCOND1]], label [[FOR_INC_US8]], label [[FOR_COND8_FOR_COND2_LOOPEXIT_CRIT_EDGE_US13:%.*]]
105 ; CHECK: for.cond2.loopexit.us11:
106 ; CHECK-NEXT: br i1 true, label [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US_LCSSA_US:%.*]], label [[FOR_BODY3_US3]]
107 ; CHECK: for.inc.lr.ph.us12:
108 ; CHECK-NEXT: br label [[FOR_INC_US8]]
109 ; CHECK: for.cond8.for.cond2.loopexit_crit_edge.us13:
110 ; CHECK-NEXT: store i32 1, i32* @b, align 4
111 ; CHECK-NEXT: br label [[FOR_COND2_LOOPEXIT_US11]]
112 ; CHECK: for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa.us:
113 ; CHECK-NEXT: br label [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA:%.*]]
114 ; CHECK: for.body3.lr.ph.split.split:
115 ; CHECK-NEXT: br label [[FOR_BODY3:%.*]]
116 ; CHECK: for.cond8.for.cond2.loopexit_crit_edge:
117 ; CHECK-NEXT: store i32 1, i32* @b, align 4
118 ; CHECK-NEXT: br label [[FOR_COND2_LOOPEXIT:%.*]]
119 ; CHECK: for.cond2.loopexit:
120 ; CHECK-NEXT: br i1 false, label [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US_LCSSA:%.*]], label [[FOR_BODY3]]
121 ; CHECK: for.body3:
122 ; CHECK-NEXT: br i1 false, label [[COND_FALSE:%.*]], label [[COND_END:%.*]]
123 ; CHECK: cond.false:
124 ; CHECK-NEXT: br label [[COND_END]]
125 ; CHECK: cond.end:
126 ; CHECK-NEXT: [[TMP10:%.*]] = load i32, i32* @b, align 4
127 ; CHECK-NEXT: [[CMP91:%.*]] = icmp slt i32 [[TMP10]], 1
128 ; CHECK-NEXT: br i1 [[CMP91]], label [[FOR_INC_LR_PH:%.*]], label [[FOR_COND2_LOOPEXIT]]
129 ; CHECK: for.inc.lr.ph:
130 ; CHECK-NEXT: br label [[FOR_INC:%.*]]
131 ; CHECK: for.inc:
132 ; CHECK-NEXT: [[TMP11:%.*]] = phi i32 [ [[TMP10]], [[FOR_INC_LR_PH]] ], [ [[INC:%.*]], [[FOR_INC]] ]
133 ; CHECK-NEXT: [[INC]] = add nsw i32 [[TMP11]], 1
134 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[INC]], 1
135 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_INC]], label [[FOR_COND8_FOR_COND2_LOOPEXIT_CRIT_EDGE:%.*]]
136 ; CHECK: for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa:
137 ; CHECK-NEXT: br label [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA]]
138 ; CHECK: for.cond2.for.inc13_crit_edge.us-lcssa:
139 ; CHECK-NEXT: [[COND_LCSSA_PH:%.*]] = phi i32 [ [[INDVARS_IV]], [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US_LCSSA]] ], [ [[INDVARS_IV]], [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US_LCSSA_US]] ]
140 ; CHECK-NEXT: br label [[FOR_COND2_FOR_INC13_CRIT_EDGE]]
141 ; CHECK: for.cond2.for.inc13_crit_edge:
142 ; CHECK-NEXT: [[COND_LCSSA:%.*]] = phi i32 [ [[COND_LCSSA_PH]], [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA]] ], [ [[COND_LCSSA_PH_US]], [[FOR_COND2_FOR_INC13_CRIT_EDGE_US_LCSSA_US]] ]
143 ; CHECK-NEXT: store i32 [[COND_LCSSA]], i32* @c, align 4
144 ; CHECK-NEXT: br label [[FOR_INC13]]
145 ; CHECK: for.inc13:
146 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nsw i32 [[INDVARS_IV]], 1
147 ; CHECK-NEXT: [[EXITCOND4:%.*]] = icmp ne i32 [[INDVARS_IV_NEXT]], 0
148 ; CHECK-NEXT: br i1 [[EXITCOND4]], label [[FOR_COND2_PREHEADER]], label [[FOR_END15:%.*]]
149 ; CHECK: for.end15:
150 ; CHECK-NEXT: ret void
151 ;
152
153 ; br i1 {{.*}}, label %[[for_inc13]], label %
154 entry:
155 %0 = load i32, i32* @a, align 4
156 %tobool2 = icmp eq i32 %0, 0
157 %1 = load i32, i32* @a, align 4
158 %tobool = icmp eq i32 %1, 0
159 br label %for.cond2.preheader
160
161 for.cond2.preheader: ; preds = %for.inc13, %entry
162 %storemerge15 = phi i8 [ -14, %entry ], [ %inc14, %for.inc13 ]
163 br i1 %tobool2, label %for.inc13, label %for.body3.lr.ph
164
165 for.body3.lr.ph: ; preds = %for.cond2.preheader
166 %tobool5 = icmp eq i8 %storemerge15, 0
167 %conv7 = sext i8 %storemerge15 to i32
168 %2 = add nsw i32 %conv7, 1
169 %3 = icmp ult i32 %2, 3
170 %div = select i1 %3, i32 %conv7, i32 0
171 br i1 %tobool5, label %for.body3.lr.ph.split.us, label %for.body3.lr.ph.for.body3.lr.ph.split_crit_edge
172
173 for.body3.lr.ph.for.body3.lr.ph.split_crit_edge: ; preds = %for.body3.lr.ph
174 br label %for.body3.lr.ph.split
175
176 for.body3.lr.ph.split.us: ; preds = %for.body3.lr.ph
177 br i1 %tobool, label %for.body3.lr.ph.split.us.split.us, label %for.body3.lr.ph.split.us.for.body3.lr.ph.split.us.split_crit_edge
178
179 for.body3.lr.ph.split.us.for.body3.lr.ph.split.us.split_crit_edge: ; preds = %for.body3.lr.ph.split.us
180 br label %for.body3.lr.ph.split.us.split
181
182 for.body3.lr.ph.split.us.split.us: ; preds = %for.body3.lr.ph.split.us
183 br label %for.body3.us.us
184
185 for.body3.us.us: ; preds = %for.cond2.loopexit.us.us, %for.body3.lr.ph.split.us.split.us
186 br i1 true, label %cond.false.us.us, label %cond.end.us.us
187
188 cond.false.us.us: ; preds = %for.body3.us.us
189 br label %cond.end.us.us
190
191 cond.end.us.us: ; preds = %cond.false.us.us, %for.body3.us.us
192 %cond.us.us = phi i32 [ %div, %cond.false.us.us ], [ %conv7, %for.body3.us.us ]
193 %4 = load i32, i32* @b, align 4
194 %cmp91.us.us = icmp slt i32 %4, 1
195 br i1 %cmp91.us.us, label %for.inc.lr.ph.us.us, label %for.cond2.loopexit.us.us
196
197 for.cond2.loopexit.us.us: ; preds = %for.cond8.for.cond2.loopexit_crit_edge.us.us, %cond.end.us.us
198 br i1 true, label %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa.us, label %for.body3.us.us
199
200 for.inc.lr.ph.us.us: ; preds = %cond.end.us.us
201 br label %for.inc.us.us
202
203 for.cond8.for.cond2.loopexit_crit_edge.us.us: ; preds = %for.inc.us.us
204 %inc.lcssa.us.us = phi i32 [ %inc.us.us, %for.inc.us.us ]
205 store i32 %inc.lcssa.us.us, i32* @b, align 4
206 br label %for.cond2.loopexit.us.us
207
208 for.inc.us.us: ; preds = %for.inc.us.us, %for.inc.lr.ph.us.us
209 %5 = phi i32 [ %4, %for.inc.lr.ph.us.us ], [ %inc.us.us, %for.inc.us.us ]
210 %inc.us.us = add nsw i32 %5, 1
211 %cmp9.us.us = icmp slt i32 %inc.us.us, 1
212 br i1 %cmp9.us.us, label %for.inc.us.us, label %for.cond8.for.cond2.loopexit_crit_edge.us.us
213
214 for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa.us: ; preds = %for.cond2.loopexit.us.us
215 %cond.lcssa.ph.us.ph.us = phi i32 [ %cond.us.us, %for.cond2.loopexit.us.us ]
216 br label %for.cond2.for.inc13_crit_edge.us-lcssa.us
217
218 for.body3.lr.ph.split.us.split: ; preds = %for.body3.lr.ph.split.us.for.body3.lr.ph.split.us.split_crit_edge
219 br label %for.body3.us
220
221 for.body3.us: ; preds = %for.cond2.loopexit.us, %for.body3.lr.ph.split.us.split
222 br i1 true, label %cond.false.us, label %cond.end.us
223
224 cond.false.us: ; preds = %for.body3.us
225 br label %cond.end.us
226
227 cond.end.us: ; preds = %cond.false.us, %for.body3.us
228 %cond.us = phi i32 [ %div, %cond.false.us ], [ %conv7, %for.body3.us ]
229 %6 = load i32, i32* @b, align 4
230 %cmp91.us = icmp slt i32 %6, 1
231 br i1 %cmp91.us, label %for.inc.lr.ph.us, label %for.cond2.loopexit.us
232
233 for.inc.us: ; preds = %for.inc.lr.ph.us, %for.inc.us
234 %7 = phi i32 [ %6, %for.inc.lr.ph.us ], [ %inc.us, %for.inc.us ]
235 %inc.us = add nsw i32 %7, 1
236 %cmp9.us = icmp slt i32 %inc.us, 1
237 br i1 %cmp9.us, label %for.inc.us, label %for.cond8.for.cond2.loopexit_crit_edge.us
238
239 for.cond2.loopexit.us: ; preds = %for.cond8.for.cond2.loopexit_crit_edge.us, %cond.end.us
240 br i1 false, label %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa, label %for.body3.us
241
242 for.inc.lr.ph.us: ; preds = %cond.end.us
243 br label %for.inc.us
244
245 for.cond8.for.cond2.loopexit_crit_edge.us: ; preds = %for.inc.us
246 %inc.lcssa.us = phi i32 [ %inc.us, %for.inc.us ]
247 store i32 %inc.lcssa.us, i32* @b, align 4
248 br label %for.cond2.loopexit.us
249
250 for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa: ; preds = %for.cond2.loopexit.us
251 %cond.lcssa.ph.us.ph = phi i32 [ %cond.us, %for.cond2.loopexit.us ]
252 br label %for.cond2.for.inc13_crit_edge.us-lcssa.us
253
254 for.cond2.for.inc13_crit_edge.us-lcssa.us: ; preds = %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa, %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa.us
255 %cond.lcssa.ph.us = phi i32 [ %cond.lcssa.ph.us.ph, %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa ], [ %cond.lcssa.ph.us.ph.us, %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa.us ]
256 br label %for.cond2.for.inc13_crit_edge
257
258 for.body3.lr.ph.split: ; preds = %for.body3.lr.ph.for.body3.lr.ph.split_crit_edge
259 br i1 %tobool, label %for.body3.lr.ph.split.split.us, label %for.body3.lr.ph.split.for.body3.lr.ph.split.split_crit_edge
260
261 for.body3.lr.ph.split.for.body3.lr.ph.split.split_crit_edge: ; preds = %for.body3.lr.ph.split
262 br label %for.body3.lr.ph.split.split
263
264 for.body3.lr.ph.split.split.us: ; preds = %for.body3.lr.ph.split
265 br label %for.body3.us3
266
267 for.body3.us3: ; preds = %for.cond2.loopexit.us11, %for.body3.lr.ph.split.split.us
268 br i1 false, label %cond.false.us4, label %cond.end.us5
269
270 cond.false.us4: ; preds = %for.body3.us3
271 br label %cond.end.us5
272
273 cond.end.us5: ; preds = %cond.false.us4, %for.body3.us3
274 %cond.us6 = phi i32 [ %div, %cond.false.us4 ], [ %conv7, %for.body3.us3 ]
275 %8 = load i32, i32* @b, align 4
276 %cmp91.us7 = icmp slt i32 %8, 1
277 br i1 %cmp91.us7, label %for.inc.lr.ph.us12, label %for.cond2.loopexit.us11
278
279 for.inc.us8: ; preds = %for.inc.lr.ph.us12, %for.inc.us8
280 %9 = phi i32 [ %8, %for.inc.lr.ph.us12 ], [ %inc.us9, %for.inc.us8 ]
281 %inc.us9 = add nsw i32 %9, 1
282 %cmp9.us10 = icmp slt i32 %inc.us9, 1
283 br i1 %cmp9.us10, label %for.inc.us8, label %for.cond8.for.cond2.loopexit_crit_edge.us13
284
285 for.cond2.loopexit.us11: ; preds = %for.cond8.for.cond2.loopexit_crit_edge.us13, %cond.end.us5
286 br i1 true, label %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa.us, label %for.body3.us3
287
288 for.inc.lr.ph.us12: ; preds = %cond.end.us5
289 br label %for.inc.us8
290
291 for.cond8.for.cond2.loopexit_crit_edge.us13: ; preds = %for.inc.us8
292 %inc.lcssa.us14 = phi i32 [ %inc.us9, %for.inc.us8 ]
293 store i32 %inc.lcssa.us14, i32* @b, align 4
294 br label %for.cond2.loopexit.us11
295
296 for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa.us: ; preds = %for.cond2.loopexit.us11
297 %cond.lcssa.ph.ph.us = phi i32 [ %cond.us6, %for.cond2.loopexit.us11 ]
298 br label %for.cond2.for.inc13_crit_edge.us-lcssa
299
300 for.body3.lr.ph.split.split: ; preds = %for.body3.lr.ph.split.for.body3.lr.ph.split.split_crit_edge
301 br label %for.body3
302
303 for.cond8.for.cond2.loopexit_crit_edge: ; preds = %for.inc
304 %inc.lcssa = phi i32 [ %inc, %for.inc ]
305 store i32 %inc.lcssa, i32* @b, align 4
306 br label %for.cond2.loopexit
307
308 for.cond2.loopexit: ; preds = %cond.end, %for.cond8.for.cond2.loopexit_crit_edge
309 br i1 false, label %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa, label %for.body3
310
311 for.body3: ; preds = %for.cond2.loopexit, %for.body3.lr.ph.split.split
312 br i1 false, label %cond.false, label %cond.end
313
314 cond.false: ; preds = %for.body3
315 br label %cond.end
316
317 cond.end: ; preds = %cond.false, %for.body3
318 %cond = phi i32 [ %div, %cond.false ], [ %conv7, %for.body3 ]
319 %10 = load i32, i32* @b, align 4
320 %cmp91 = icmp slt i32 %10, 1
321 br i1 %cmp91, label %for.inc.lr.ph, label %for.cond2.loopexit
322
323 for.inc.lr.ph: ; preds = %cond.end
324 br label %for.inc
325
326 for.inc: ; preds = %for.inc, %for.inc.lr.ph
327 %11 = phi i32 [ %10, %for.inc.lr.ph ], [ %inc, %for.inc ]
328 %inc = add nsw i32 %11, 1
329 %cmp9 = icmp slt i32 %inc, 1
330 br i1 %cmp9, label %for.inc, label %for.cond8.for.cond2.loopexit_crit_edge
331
332 for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa: ; preds = %for.cond2.loopexit
333 %cond.lcssa.ph.ph = phi i32 [ %cond, %for.cond2.loopexit ]
334 br label %for.cond2.for.inc13_crit_edge.us-lcssa
335
336 for.cond2.for.inc13_crit_edge.us-lcssa: ; preds = %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa, %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa.us
337 %cond.lcssa.ph = phi i32 [ %cond.lcssa.ph.ph, %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa ], [ %cond.lcssa.ph.ph.us, %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa.us ]
338 br label %for.cond2.for.inc13_crit_edge
339
340 for.cond2.for.inc13_crit_edge: ; preds = %for.cond2.for.inc13_crit_edge.us-lcssa, %for.cond2.for.inc13_crit_edge.us-lcssa.us
341 %cond.lcssa = phi i32 [ %cond.lcssa.ph, %for.cond2.for.inc13_crit_edge.us-lcssa ], [ %cond.lcssa.ph.us, %for.cond2.for.inc13_crit_edge.us-lcssa.us ]
342 store i32 %cond.lcssa, i32* @c, align 4
343 br label %for.inc13
344
345 for.inc13: ; preds = %for.cond2.for.inc13_crit_edge, %for.cond2.preheader
346 %inc14 = add i8 %storemerge15, 1
347 %cmp = icmp ugt i8 %inc14, 50
348 br i1 %cmp, label %for.cond2.preheader, label %for.end15
349
350 for.end15: ; preds = %for.inc13
351 ret void
352 }
+0
-223
test/Transforms/IndVarSimplify/pr20680.ll less more
None ; RUN: opt < %s -indvars -S | FileCheck %s
1
2 ; Provide legal integer types.
3 target datalayout = "n8:16:32:64"
4
5
6 @a = common global i32 0, align 4
7 @c = common global i32 0, align 4
8 @b = common global i32 0, align 4
9
10 define void @f() {
11 ; CHECK-LABEL: @f(
12 ; CHECK-LABEL: entry:
13 ; CHECK: br label %[[for_cond2_preheader:.*]]
14
15 ; CHECK: [[for_cond2_preheader]]:
16 ; CHECK-NEXT: %[[indvars_iv:.*]] = phi i32 [ %[[indvars_iv_next:.*]], %[[for_inc13:.*]] ], [ -14, %entry ]
17 ; br i1 {{.*}}, label %[[for_inc13]], label %
18 entry:
19 %0 = load i32, i32* @a, align 4
20 %tobool2 = icmp eq i32 %0, 0
21 %1 = load i32, i32* @a, align 4
22 %tobool = icmp eq i32 %1, 0
23 br label %for.cond2.preheader
24
25 for.cond2.preheader: ; preds = %for.inc13, %entry
26 %storemerge15 = phi i8 [ -14, %entry ], [ %inc14, %for.inc13 ]
27 br i1 %tobool2, label %for.inc13, label %for.body3.lr.ph
28
29 for.body3.lr.ph: ; preds = %for.cond2.preheader
30 %tobool5 = icmp eq i8 %storemerge15, 0
31 %conv7 = sext i8 %storemerge15 to i32
32 %2 = add nsw i32 %conv7, 1
33 %3 = icmp ult i32 %2, 3
34 %div = select i1 %3, i32 %conv7, i32 0
35 br i1 %tobool5, label %for.body3.lr.ph.split.us, label %for.body3.lr.ph.for.body3.lr.ph.split_crit_edge
36
37 for.body3.lr.ph.for.body3.lr.ph.split_crit_edge: ; preds = %for.body3.lr.ph
38 br label %for.body3.lr.ph.split
39
40 for.body3.lr.ph.split.us: ; preds = %for.body3.lr.ph
41 br i1 %tobool, label %for.body3.lr.ph.split.us.split.us, label %for.body3.lr.ph.split.us.for.body3.lr.ph.split.us.split_crit_edge
42
43 for.body3.lr.ph.split.us.for.body3.lr.ph.split.us.split_crit_edge: ; preds = %for.body3.lr.ph.split.us
44 br label %for.body3.lr.ph.split.us.split
45
46 for.body3.lr.ph.split.us.split.us: ; preds = %for.body3.lr.ph.split.us
47 br label %for.body3.us.us
48
49 for.body3.us.us: ; preds = %for.cond2.loopexit.us.us, %for.body3.lr.ph.split.us.split.us
50 br i1 true, label %cond.false.us.us, label %cond.end.us.us
51
52 cond.false.us.us: ; preds = %for.body3.us.us
53 br label %cond.end.us.us
54
55 cond.end.us.us: ; preds = %cond.false.us.us, %for.body3.us.us
56 %cond.us.us = phi i32 [ %div, %cond.false.us.us ], [ %conv7, %for.body3.us.us ]
57 %4 = load i32, i32* @b, align 4
58 %cmp91.us.us = icmp slt i32 %4, 1
59 br i1 %cmp91.us.us, label %for.inc.lr.ph.us.us, label %for.cond2.loopexit.us.us
60
61 for.cond2.loopexit.us.us: ; preds = %for.cond8.for.cond2.loopexit_crit_edge.us.us, %cond.end.us.us
62 br i1 true, label %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa.us, label %for.body3.us.us
63
64 for.inc.lr.ph.us.us: ; preds = %cond.end.us.us
65 br label %for.inc.us.us
66
67 for.cond8.for.cond2.loopexit_crit_edge.us.us: ; preds = %for.inc.us.us
68 %inc.lcssa.us.us = phi i32 [ %inc.us.us, %for.inc.us.us ]
69 store i32 %inc.lcssa.us.us, i32* @b, align 4
70 br label %for.cond2.loopexit.us.us
71
72 for.inc.us.us: ; preds = %for.inc.us.us, %for.inc.lr.ph.us.us
73 %5 = phi i32 [ %4, %for.inc.lr.ph.us.us ], [ %inc.us.us, %for.inc.us.us ]
74 %inc.us.us = add nsw i32 %5, 1
75 %cmp9.us.us = icmp slt i32 %inc.us.us, 1
76 br i1 %cmp9.us.us, label %for.inc.us.us, label %for.cond8.for.cond2.loopexit_crit_edge.us.us
77
78 for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa.us: ; preds = %for.cond2.loopexit.us.us
79 %cond.lcssa.ph.us.ph.us = phi i32 [ %cond.us.us, %for.cond2.loopexit.us.us ]
80 br label %for.cond2.for.inc13_crit_edge.us-lcssa.us
81
82 for.body3.lr.ph.split.us.split: ; preds = %for.body3.lr.ph.split.us.for.body3.lr.ph.split.us.split_crit_edge
83 br label %for.body3.us
84
85 for.body3.us: ; preds = %for.cond2.loopexit.us, %for.body3.lr.ph.split.us.split
86 br i1 true, label %cond.false.us, label %cond.end.us
87
88 cond.false.us: ; preds = %for.body3.us
89 br label %cond.end.us
90
91 cond.end.us: ; preds = %cond.false.us, %for.body3.us
92 %cond.us = phi i32 [ %div, %cond.false.us ], [ %conv7, %for.body3.us ]
93 %6 = load i32, i32* @b, align 4
94 %cmp91.us = icmp slt i32 %6, 1
95 br i1 %cmp91.us, label %for.inc.lr.ph.us, label %for.cond2.loopexit.us
96
97 for.inc.us: ; preds = %for.inc.lr.ph.us, %for.inc.us
98 %7 = phi i32 [ %6, %for.inc.lr.ph.us ], [ %inc.us, %for.inc.us ]
99 %inc.us = add nsw i32 %7, 1
100 %cmp9.us = icmp slt i32 %inc.us, 1
101 br i1 %cmp9.us, label %for.inc.us, label %for.cond8.for.cond2.loopexit_crit_edge.us
102
103 for.cond2.loopexit.us: ; preds = %for.cond8.for.cond2.loopexit_crit_edge.us, %cond.end.us
104 br i1 false, label %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa, label %for.body3.us
105
106 for.inc.lr.ph.us: ; preds = %cond.end.us
107 br label %for.inc.us
108
109 for.cond8.for.cond2.loopexit_crit_edge.us: ; preds = %for.inc.us
110 %inc.lcssa.us = phi i32 [ %inc.us, %for.inc.us ]
111 store i32 %inc.lcssa.us, i32* @b, align 4
112 br label %for.cond2.loopexit.us
113
114 for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa: ; preds = %for.cond2.loopexit.us
115 %cond.lcssa.ph.us.ph = phi i32 [ %cond.us, %for.cond2.loopexit.us ]
116 br label %for.cond2.for.inc13_crit_edge.us-lcssa.us
117
118 for.cond2.for.inc13_crit_edge.us-lcssa.us: ; preds = %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa, %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa.us
119 %cond.lcssa.ph.us = phi i32 [ %cond.lcssa.ph.us.ph, %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa ], [ %cond.lcssa.ph.us.ph.us, %for.cond2.for.inc13_crit_edge.us-lcssa.us.us-lcssa.us ]
120 br label %for.cond2.for.inc13_crit_edge
121
122 for.body3.lr.ph.split: ; preds = %for.body3.lr.ph.for.body3.lr.ph.split_crit_edge
123 br i1 %tobool, label %for.body3.lr.ph.split.split.us, label %for.body3.lr.ph.split.for.body3.lr.ph.split.split_crit_edge
124
125 for.body3.lr.ph.split.for.body3.lr.ph.split.split_crit_edge: ; preds = %for.body3.lr.ph.split
126 br label %for.body3.lr.ph.split.split
127
128 for.body3.lr.ph.split.split.us: ; preds = %for.body3.lr.ph.split
129 br label %for.body3.us3
130
131 for.body3.us3: ; preds = %for.cond2.loopexit.us11, %for.body3.lr.ph.split.split.us
132 br i1 false, label %cond.false.us4, label %cond.end.us5
133
134 cond.false.us4: ; preds = %for.body3.us3
135 br label %cond.end.us5
136
137 cond.end.us5: ; preds = %cond.false.us4, %for.body3.us3
138 %cond.us6 = phi i32 [ %div, %cond.false.us4 ], [ %conv7, %for.body3.us3 ]
139 %8 = load i32, i32* @b, align 4
140 %cmp91.us7 = icmp slt i32 %8, 1
141 br i1 %cmp91.us7, label %for.inc.lr.ph.us12, label %for.cond2.loopexit.us11
142
143 for.inc.us8: ; preds = %for.inc.lr.ph.us12, %for.inc.us8
144 %9 = phi i32 [ %8, %for.inc.lr.ph.us12 ], [ %inc.us9, %for.inc.us8 ]
145 %inc.us9 = add nsw i32 %9, 1
146 %cmp9.us10 = icmp slt i32 %inc.us9, 1
147 br i1 %cmp9.us10, label %for.inc.us8, label %for.cond8.for.cond2.loopexit_crit_edge.us13
148
149 for.cond2.loopexit.us11: ; preds = %for.cond8.for.cond2.loopexit_crit_edge.us13, %cond.end.us5
150 br i1 true, label %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa.us, label %for.body3.us3
151
152 for.inc.lr.ph.us12: ; preds = %cond.end.us5
153 br label %for.inc.us8
154
155 for.cond8.for.cond2.loopexit_crit_edge.us13: ; preds = %for.inc.us8
156 %inc.lcssa.us14 = phi i32 [ %inc.us9, %for.inc.us8 ]
157 store i32 %inc.lcssa.us14, i32* @b, align 4
158 br label %for.cond2.loopexit.us11
159
160 for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa.us: ; preds = %for.cond2.loopexit.us11
161 %cond.lcssa.ph.ph.us = phi i32 [ %cond.us6, %for.cond2.loopexit.us11 ]
162 br label %for.cond2.for.inc13_crit_edge.us-lcssa
163
164 for.body3.lr.ph.split.split: ; preds = %for.body3.lr.ph.split.for.body3.lr.ph.split.split_crit_edge
165 br label %for.body3
166
167 for.cond8.for.cond2.loopexit_crit_edge: ; preds = %for.inc
168 %inc.lcssa = phi i32 [ %inc, %for.inc ]
169 store i32 %inc.lcssa, i32* @b, align 4
170 br label %for.cond2.loopexit
171
172 for.cond2.loopexit: ; preds = %cond.end, %for.cond8.for.cond2.loopexit_crit_edge
173 br i1 false, label %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa, label %for.body3
174
175 for.body3: ; preds = %for.cond2.loopexit, %for.body3.lr.ph.split.split
176 br i1 false, label %cond.false, label %cond.end
177
178 cond.false: ; preds = %for.body3
179 br label %cond.end
180
181 cond.end: ; preds = %cond.false, %for.body3
182 %cond = phi i32 [ %div, %cond.false ], [ %conv7, %for.body3 ]
183 %10 = load i32, i32* @b, align 4
184 %cmp91 = icmp slt i32 %10, 1
185 br i1 %cmp91, label %for.inc.lr.ph, label %for.cond2.loopexit
186
187 for.inc.lr.ph: ; preds = %cond.end
188 br label %for.inc
189
190 for.inc: ; preds = %for.inc, %for.inc.lr.ph
191 %11 = phi i32 [ %10, %for.inc.lr.ph ], [ %inc, %for.inc ]
192 %inc = add nsw i32 %11, 1
193 %cmp9 = icmp slt i32 %inc, 1
194 br i1 %cmp9, label %for.inc, label %for.cond8.for.cond2.loopexit_crit_edge
195
196 for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa: ; preds = %for.cond2.loopexit
197 %cond.lcssa.ph.ph = phi i32 [ %cond, %for.cond2.loopexit ]
198 br label %for.cond2.for.inc13_crit_edge.us-lcssa
199
200 for.cond2.for.inc13_crit_edge.us-lcssa: ; preds = %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa, %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa.us
201 %cond.lcssa.ph = phi i32 [ %cond.lcssa.ph.ph, %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa ], [ %cond.lcssa.ph.ph.us, %for.cond2.for.inc13_crit_edge.us-lcssa.us-lcssa.us ]
202 br label %for.cond2.for.inc13_crit_edge
203
204 for.cond2.for.inc13_crit_edge: ; preds = %for.cond2.for.inc13_crit_edge.us-lcssa, %for.cond2.for.inc13_crit_edge.us-lcssa.us
205 %cond.lcssa = phi i32 [ %cond.lcssa.ph, %for.cond2.for.inc13_crit_edge.us-lcssa ], [ %cond.lcssa.ph.us, %for.cond2.for.inc13_crit_edge.us-lcssa.us ]
206 store i32 %cond.lcssa, i32* @c, align 4
207 br label %for.inc13
208
209 ; CHECK: [[for_inc13]]:
210 ; CHECK-NEXT: %[[indvars_iv_next]] = add nsw i32 %[[indvars_iv]], 1
211 ; CHECK-NEXT: %[[exitcond4:.*]] = icmp ne i32 %[[indvars_iv_next]], 0
212 ; CHECK-NEXT: br i1 %[[exitcond4]], label %[[for_cond2_preheader]], label %[[for_end15:.*]]
213 for.inc13: ; preds = %for.cond2.for.inc13_crit_edge, %for.cond2.preheader
214 %inc14 = add i8 %storemerge15, 1
215 %cmp = icmp ugt i8 %inc14, 50
216 br i1 %cmp, label %for.cond2.preheader, label %for.end15
217
218 ; CHECK: [[for_end15]]:
219 ; CHECK-NEXT: ret void
220 for.end15: ; preds = %for.inc13
221 ret void
222 }