llvm.org GIT mirror llvm / 5b6bbc8
[TEST] Update test comments, refactor checks with update_test_checks.py This patch changes messages in guards-related tests to adequately reflect reality. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354101 91177308-0d34-0410-b5e6-96231b3b80d8 Max Kazantsev 7 months ago
1 changed file(s) with 242 addition(s) and 116 deletion(s). Raw diff Collapse all Expand all
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; REQUIRES: asserts
12 ; RUN: opt -licm -basicaa -ipt-expensive-asserts=true < %s -S | FileCheck %s
23 ; RUN: opt -aa-pipeline=basic-aa -passes='require,require,require,require,loop(licm)' -ipt-expensive-asserts=true < %s -S | FileCheck %s
45 ; Hoist guard and load.
56 define void @test1(i1 %cond, i32* %ptr) {
67 ; CHECK-LABEL: @test1(
7 ; CHECK-LABEL: entry:
8 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %cond)
9 ; CHECK: %val = load i32, i32* %ptr
10 ; CHECK-LABEL: loop:
8 ; CHECK-NEXT: entry:
9 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND:%.*]]) [ "deopt"(i32 0) ]
10 ; CHECK-NEXT: [[VAL:%.*]] = load i32, i32* [[PTR:%.*]]
11 ; CHECK-NEXT: br label [[LOOP:%.*]]
12 ; CHECK: loop:
13 ; CHECK-NEXT: [[X:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[X_INC:%.*]], [[LOOP]] ]
14 ; CHECK-NEXT: [[X_INC]] = add i32 [[X]], [[VAL]]
15 ; CHECK-NEXT: br label [[LOOP]]
16 ;
1117
1218 entry:
1319 br label %loop
2329 ; Can't hoist over a side effect
2430 define void @test2(i1 %cond, i32* %ptr) {
2531 ; CHECK-LABEL: @test2(
26 ; CHECK-LABEL: entry:
27 ; CHECK-LABEL: loop:
28 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %cond)
29 ; CHECK: %val = load i32, i32* %ptr
32 ; CHECK-NEXT: entry:
33 ; CHECK-NEXT: br label [[LOOP:%.*]]
34 ; CHECK: loop:
35 ; CHECK-NEXT: [[X:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[X_INC:%.*]], [[LOOP]] ]
36 ; CHECK-NEXT: store i32 0, i32* [[PTR:%.*]]
37 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND:%.*]]) [ "deopt"(i32 0) ]
38 ; CHECK-NEXT: [[VAL:%.*]] = load i32, i32* [[PTR]]
39 ; CHECK-NEXT: [[X_INC]] = add i32 [[X]], [[VAL]]
40 ; CHECK-NEXT: br label [[LOOP]]
41 ;
3042
3143 entry:
3244 br label %loop
4355 ; Can't hoist over a side effect
4456 define void @test2b(i1 %cond, i32* %ptr) {
4557 ; CHECK-LABEL: @test2b(
46 ; CHECK-LABEL: entry:
47 ; CHECK-LABEL: loop:
48 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %cond)
49 ; CHECK: %val = load i32, i32* %ptr
58 ; CHECK-NEXT: entry:
59 ; CHECK-NEXT: [[P2:%.*]] = getelementptr i32, i32* [[PTR:%.*]], i32 1
60 ; CHECK-NEXT: br label [[LOOP:%.*]]
61 ; CHECK: loop:
62 ; CHECK-NEXT: [[X:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[X_INC:%.*]], [[LOOP]] ]
63 ; CHECK-NEXT: store i32 0, i32* [[P2]]
64 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND:%.*]]) [ "deopt"(i32 0) ]
65 ; CHECK-NEXT: [[VAL:%.*]] = load i32, i32* [[PTR]]
66 ; CHECK-NEXT: [[X_INC]] = add i32 [[X]], [[VAL]]
67 ; CHECK-NEXT: br label [[LOOP]]
68 ;
5069
5170 entry:
5271 br label %loop
6180 br label %loop
6281 }
6382
64
6583 ; Hoist guard. Cannot hoist load because of aliasing.
6684 define void @test3(i1 %cond, i32* %ptr) {
6785 ; CHECK-LABEL: @test3(
68 ; CHECK-LABEL: entry:
69 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %cond)
70 ; CHECK-LABEL: loop:
71 ; CHECK: %val = load i32, i32* %ptr
72 ; CHECK: store i32 0, i32* %ptr
86 ; CHECK-NEXT: entry:
87 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND:%.*]]) [ "deopt"(i32 0) ]
88 ; CHECK-NEXT: br label [[LOOP:%.*]]
89 ; CHECK: loop:
90 ; CHECK-NEXT: [[X:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[X_INC:%.*]], [[LOOP]] ]
91 ; CHECK-NEXT: [[VAL:%.*]] = load i32, i32* [[PTR:%.*]]
92 ; CHECK-NEXT: store i32 0, i32* [[PTR]]
93 ; CHECK-NEXT: [[X_INC]] = add i32 [[X]], [[VAL]]
94 ; CHECK-NEXT: br label [[LOOP]]
95 ;
7396
7497 entry:
7598 br label %loop
83106 br label %loop
84107 }
85108
86
109 ; Hoist load and guard.
87110 define void @test4(i1 %c, i32* %p) {
88
89111 ; CHECK-LABEL: @test4(
90 ; CHECK-LABEL: entry:
91 ; CHECK: %a = load i32, i32* %p
92 ; CHECK: %invariant_cond = icmp ne i32 %a, 100
93 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond)
94 ; CHECK-LABEL: loop:
95 ; CHECK-LABEL: backedge:
112 ; CHECK-NEXT: entry:
113 ; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[P:%.*]]
114 ; CHECK-NEXT: [[INVARIANT_COND:%.*]] = icmp ne i32 [[A]], 100
115 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[INVARIANT_COND]]) [ "deopt"() ]
116 ; CHECK-NEXT: br label [[LOOP:%.*]]
117 ; CHECK: loop:
118 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
119 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
120 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
121 ; CHECK: if.true:
122 ; CHECK-NEXT: br label [[BACKEDGE]]
123 ; CHECK: if.false:
124 ; CHECK-NEXT: br label [[BACKEDGE]]
125 ; CHECK: backedge:
126 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp slt i32 [[IV_NEXT]], 1000
127 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
128 ; CHECK: exit:
129 ; CHECK-NEXT: ret void
130 ;
96131
97132 entry:
98133 br label %loop
121156
122157 ; Do not hoist across a conditionally executed side effect.
123158 define void @test4a(i1 %c, i32* %p, i32* %q) {
124
125159 ; CHECK-LABEL: @test4a(
126 ; CHECK-LABEL: entry:
127 ; CHECK-LABEL: loop:
128 ; CHECK-LABEL: if.true:
129 ; CHECK: store
130 ; CHECK-LABEL: backedge:
131 ; CHECK: %a = load i32, i32* %p
132 ; CHECK: %invariant_cond = icmp ne i32 %a, 100
133 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond)
160 ; CHECK-NEXT: entry:
161 ; CHECK-NEXT: br label [[LOOP:%.*]]
162 ; CHECK: loop:
163 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
164 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
165 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
166 ; CHECK: if.true:
167 ; CHECK-NEXT: store i32 123, i32* [[Q:%.*]]
168 ; CHECK-NEXT: br label [[BACKEDGE]]
169 ; CHECK: if.false:
170 ; CHECK-NEXT: br label [[BACKEDGE]]
171 ; CHECK: backedge:
172 ; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[P:%.*]]
173 ; CHECK-NEXT: [[INVARIANT_COND:%.*]] = icmp ne i32 [[A]], 100
174 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[INVARIANT_COND]]) [ "deopt"() ]
175 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp slt i32 [[IV_NEXT]], 1000
176 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
177 ; CHECK: exit:
178 ; CHECK-NEXT: ret void
179 ;
134180
135181 entry:
136182 br label %loop
160206
161207 ; Do not hoist a conditionally executed guard.
162208 define void @test4b(i1 %c, i32* %p, i32* %q) {
163
164209 ; CHECK-LABEL: @test4b(
165 ; CHECK-LABEL: entry:
166 ; CHECK-LABEL: loop:
167 ; CHECK-LABEL: if.true:
168 ; CHECK: %a = load i32, i32* %p
169 ; CHECK: %invariant_cond = icmp ne i32 %a, 100
170 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond)
171 ; CHECK-LABEL: backedge:
172
173 entry:
174 br label %loop
175
176 loop:
177 %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]
178 %iv.next = add i32 %iv, 1
179 br i1 %c, label %if.true, label %if.false
180
181 if.true:
182 %a = load i32, i32* %p
183 %invariant_cond = icmp ne i32 %a, 100
184 call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond) [ "deopt"() ]
185 br label %backedge
186
187 if.false:
188 br label %backedge
189
190 backedge:
191 %loop_cond = icmp slt i32 %iv.next, 1000
192 br i1 %loop_cond, label %loop, label %exit
193
194 exit:
195 ret void
196 }
197
198 ; Check that we don't hoist across a store in the header.
210 ; CHECK-NEXT: entry:
211 ; CHECK-NEXT: br label [[LOOP:%.*]]
212 ; CHECK: loop:
213 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
214 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
215 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
216 ; CHECK: if.true:
217 ; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[P:%.*]]
218 ; CHECK-NEXT: [[INVARIANT_COND:%.*]] = icmp ne i32 [[A]], 100
219 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[INVARIANT_COND]]) [ "deopt"() ]
220 ; CHECK-NEXT: br label [[BACKEDGE]]
221 ; CHECK: if.false:
222 ; CHECK-NEXT: br label [[BACKEDGE]]
223 ; CHECK: backedge:
224 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp slt i32 [[IV_NEXT]], 1000
225 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
226 ; CHECK: exit:
227 ; CHECK-NEXT: ret void
228 ;
229
230 entry:
231 br label %loop
232
233 loop:
234 %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]
235 %iv.next = add i32 %iv, 1
236 br i1 %c, label %if.true, label %if.false
237
238 if.true:
239 %a = load i32, i32* %p
240 %invariant_cond = icmp ne i32 %a, 100
241 call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond) [ "deopt"() ]
242 br label %backedge
243
244 if.false:
245 br label %backedge
246
247 backedge:
248 %loop_cond = icmp slt i32 %iv.next, 1000
249 br i1 %loop_cond, label %loop, label %exit
250
251 exit:
252 ret void
253 }
254
255 ; Hoist store, load and guard.
199256 define void @test4c(i1 %c, i32* %p, i8* noalias %s) {
200
201257 ; CHECK-LABEL: @test4c(
202 ; CHECK-LABEL: entry:
203 ; CHECK: %a = load i32, i32* %p
204 ; CHECK: %invariant_cond = icmp ne i32 %a, 100
205 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond)
206 ; CHECK-LABEL: loop:
207 ; CHECK-LABEL: backedge:
258 ; CHECK-NEXT: entry:
259 ; CHECK-NEXT: store i8 0, i8* [[S:%.*]]
260 ; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[P:%.*]]
261 ; CHECK-NEXT: [[INVARIANT_COND:%.*]] = icmp ne i32 [[A]], 100
262 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[INVARIANT_COND]]) [ "deopt"() ]
263 ; CHECK-NEXT: br label [[LOOP:%.*]]
264 ; CHECK: loop:
265 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
266 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
267 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
268 ; CHECK: if.true:
269 ; CHECK-NEXT: br label [[BACKEDGE]]
270 ; CHECK: if.false:
271 ; CHECK-NEXT: br label [[BACKEDGE]]
272 ; CHECK: backedge:
273 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp slt i32 [[IV_NEXT]], 1000
274 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
275 ; CHECK: exit:
276 ; CHECK-NEXT: ret void
277 ;
208278
209279 entry:
210280 br label %loop
232302 ret void
233303 }
234304
235 ; Check that we don't hoist across a store in a conditionally execute block.
305 ; Check that we don't hoist across a store in a conditionally executed block.
236306 define void @test4d(i1 %c, i32* %p, i8* noalias %s) {
237
238307 ; CHECK-LABEL: @test4d(
239 ; CHECK-LABEL: entry:
240 ; CHECK: %a = load i32, i32* %p
241 ; CHECK: %invariant_cond = icmp ne i32 %a, 100
242 ; CHECK-LABEL: loop:
243 ; CHECK-LABEL: backedge:
244 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond)
308 ; CHECK-NEXT: entry:
309 ; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[P:%.*]]
310 ; CHECK-NEXT: [[INVARIANT_COND:%.*]] = icmp ne i32 [[A]], 100
311 ; CHECK-NEXT: br label [[LOOP:%.*]]
312 ; CHECK: loop:
313 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
314 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
315 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
316 ; CHECK: if.true:
317 ; CHECK-NEXT: store i8 0, i8* [[S:%.*]]
318 ; CHECK-NEXT: br label [[BACKEDGE]]
319 ; CHECK: if.false:
320 ; CHECK-NEXT: br label [[BACKEDGE]]
321 ; CHECK: backedge:
322 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[INVARIANT_COND]]) [ "deopt"() ]
323 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp slt i32 [[IV_NEXT]], 1000
324 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
325 ; CHECK: exit:
326 ; CHECK-NEXT: ret void
327 ;
245328
246329 entry:
247330 br label %loop
271354
272355 ; Check that we don't hoist across a store before the guard in the backedge.
273356 define void @test4e(i1 %c, i32* %p, i8* noalias %s) {
274
275357 ; CHECK-LABEL: @test4e(
276 ; CHECK-LABEL: entry:
277 ; CHECK: %a = load i32, i32* %p
278 ; CHECK: %invariant_cond = icmp ne i32 %a, 100
279 ; CHECK: store i8 0, i8* %s
280 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond)
281 ; CHECK-LABEL: loop:
282 ; CHECK-LABEL: backedge:
358 ; CHECK-NEXT: entry:
359 ; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[P:%.*]]
360 ; CHECK-NEXT: [[INVARIANT_COND:%.*]] = icmp ne i32 [[A]], 100
361 ; CHECK-NEXT: store i8 0, i8* [[S:%.*]]
362 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[INVARIANT_COND]]) [ "deopt"() ]
363 ; CHECK-NEXT: br label [[LOOP:%.*]]
364 ; CHECK: loop:
365 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
366 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
367 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
368 ; CHECK: if.true:
369 ; CHECK-NEXT: br label [[BACKEDGE]]
370 ; CHECK: if.false:
371 ; CHECK-NEXT: br label [[BACKEDGE]]
372 ; CHECK: backedge:
373 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp slt i32 [[IV_NEXT]], 1000
374 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
375 ; CHECK: exit:
376 ; CHECK-NEXT: ret void
377 ;
283378
284379 entry:
285380 br label %loop
309404
310405 ; Check that we can hoist the guard in spite of store which happens after.
311406 define void @test4f(i1 %c, i32* %p, i8* noalias %s) {
312
313407 ; CHECK-LABEL: @test4f(
314 ; CHECK-LABEL: entry:
315 ; CHECK: %a = load i32, i32* %p
316 ; CHECK: %invariant_cond = icmp ne i32 %a, 100
317 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond)
318 ; CHECK-LABEL: loop:
319 ; CHECK-LABEL: backedge:
408 ; CHECK-NEXT: entry:
409 ; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[P:%.*]]
410 ; CHECK-NEXT: [[INVARIANT_COND:%.*]] = icmp ne i32 [[A]], 100
411 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[INVARIANT_COND]]) [ "deopt"() ]
412 ; CHECK-NEXT: store i8 0, i8* [[S:%.*]]
413 ; CHECK-NEXT: br label [[LOOP:%.*]]
414 ; CHECK: loop:
415 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
416 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
417 ; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
418 ; CHECK: if.true:
419 ; CHECK-NEXT: br label [[BACKEDGE]]
420 ; CHECK: if.false:
421 ; CHECK-NEXT: br label [[BACKEDGE]]
422 ; CHECK: backedge:
423 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp slt i32 [[IV_NEXT]], 1000
424 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
425 ; CHECK: exit:
426 ; CHECK-NEXT: ret void
427 ;
320428
321429 entry:
322430 br label %loop
346454
347455 ; Do not hoist an invariant guard across a variant guard.
348456 define void @test5(i1 %c, i32* %p, i32* %q) {
349
350457 ; CHECK-LABEL: @test5(
351 ; CHECK-LABEL: entry:
352 ; CHECK: %a = load i32, i32* %p
353 ; CHECK: %invariant_cond = icmp ne i32 %a, 100
354 ; CHECK-LABEL: loop:
355 ; CHECK: %variant_cond = icmp ne i32 %a, %iv
356 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %variant_cond)
357 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond)
458 ; CHECK-NEXT: entry:
459 ; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[P:%.*]]
460 ; CHECK-NEXT: [[INVARIANT_COND:%.*]] = icmp ne i32 [[A]], 100
461 ; CHECK-NEXT: br label [[LOOP:%.*]]
462 ; CHECK: loop:
463 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
464 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
465 ; CHECK-NEXT: [[VARIANT_COND:%.*]] = icmp ne i32 [[A]], [[IV]]
466 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[VARIANT_COND]]) [ "deopt"() ]
467 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[INVARIANT_COND]]) [ "deopt"() ]
468 ; CHECK-NEXT: br label [[BACKEDGE]]
469 ; CHECK: backedge:
470 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp slt i32 [[IV_NEXT]], 1000
471 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
472 ; CHECK: exit:
473 ; CHECK-NEXT: ret void
474 ;
358475
359476 entry:
360477 br label %loop
379496
380497 ; Hoist an invariant guard, leave the following variant guard in the loop.
381498 define void @test5a(i1 %c, i32* %p, i32* %q) {
382
383499 ; CHECK-LABEL: @test5a(
384 ; CHECK-LABEL: entry:
385 ; CHECK: %a = load i32, i32* %p
386 ; CHECK: %invariant_cond = icmp ne i32 %a, 100
387 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %invariant_cond)
388 ; CHECK-LABEL: loop:
389 ; CHECK: %variant_cond = icmp ne i32 %a, %iv
390 ; CHECK: call void (i1, ...) @llvm.experimental.guard(i1 %variant_cond)
500 ; CHECK-NEXT: entry:
501 ; CHECK-NEXT: [[A:%.*]] = load i32, i32* [[P:%.*]]
502 ; CHECK-NEXT: [[INVARIANT_COND:%.*]] = icmp ne i32 [[A]], 100
503 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[INVARIANT_COND]]) [ "deopt"() ]
504 ; CHECK-NEXT: br label [[LOOP:%.*]]
505 ; CHECK: loop:
506 ; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
507 ; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
508 ; CHECK-NEXT: [[VARIANT_COND:%.*]] = icmp ne i32 [[A]], [[IV]]
509 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[VARIANT_COND]]) [ "deopt"() ]
510 ; CHECK-NEXT: br label [[BACKEDGE]]
511 ; CHECK: backedge:
512 ; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp slt i32 [[IV_NEXT]], 1000
513 ; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
514 ; CHECK: exit:
515 ; CHECK-NEXT: ret void
516 ;
391517
392518 entry:
393519 br label %loop