1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt -S -openmp-deduce-icv-values -passes=openmp-opt < %s | FileCheck %s
4 %struct.ident_t = type { i32, i32, i32, i32, ptr }
6 @.str = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
7 @0 = private unnamed_addr global %struct.ident_t { i32 0, i32 2, i32 0, i32 0, ptr @.str }, align 8
9 ; doesn't modify any ICVs.
10 define i32 @icv_free_use(i32 %0) {
11 ; CHECK-LABEL: define {{[^@]+}}@icv_free_use
12 ; CHECK-SAME: (i32 [[TMP0:%.*]]) {
13 ; CHECK-NEXT: [[TMP2:%.*]] = add nsw i32 [[TMP0]], 1
14 ; CHECK-NEXT: ret i32 [[TMP2]]
16 %2 = add nsw i32 %0, 1
20 define i32 @bad_use(i32 %0) {
21 ; CHECK-LABEL: define {{[^@]+}}@bad_use
22 ; CHECK-SAME: (i32 [[TMP0:%.*]]) {
23 ; CHECK-NEXT: tail call void @use(i32 [[TMP0]])
24 ; CHECK-NEXT: [[TMP2:%.*]] = add nsw i32 [[TMP0]], 1
25 ; CHECK-NEXT: ret i32 [[TMP2]]
27 tail call void @use(i32 %0)
28 %2 = add nsw i32 %0, 1
32 define i32 @ok_use_assume(i32 %0) {
33 ; CHECK-LABEL: define {{[^@]+}}@ok_use_assume
34 ; CHECK-SAME: (i32 [[TMP0:%.*]]) {
35 ; CHECK-NEXT: call void @use(i32 [[TMP0]]) #[[ATTR1:[0-9]+]]
36 ; CHECK-NEXT: call void @use(i32 [[TMP0]]) #[[ATTR2:[0-9]+]]
37 ; CHECK-NEXT: call void @no_openmp_use(i32 [[TMP0]])
38 ; CHECK-NEXT: [[TMP2:%.*]] = add nsw i32 [[TMP0]], 1
39 ; CHECK-NEXT: ret i32 [[TMP2]]
41 call void @use(i32 %0) "no_openmp"
42 call void @use(i32 %0) "no_openmp_routines"
43 call void @no_openmp_use(i32 %0)
44 %2 = add nsw i32 %0, 1
48 define void @indirect_call(ptr %0) {
49 ; CHECK-LABEL: define {{[^@]+}}@indirect_call
50 ; CHECK-SAME: (ptr [[TMP0:%.*]]) {
51 ; CHECK-NEXT: call void @omp_set_num_threads(i32 4)
52 ; CHECK-NEXT: tail call void [[TMP0]]()
53 ; CHECK-NEXT: [[TMP2:%.*]] = tail call i32 @omp_get_max_threads()
54 ; CHECK-NEXT: tail call void @use(i32 [[TMP2]])
55 ; CHECK-NEXT: ret void
57 call void @omp_set_num_threads(i32 4)
59 %2 = tail call i32 @omp_get_max_threads()
60 tail call void @use(i32 %2)
64 define dso_local i32 @foo(i32 %0, i32 %1) {
65 ; CHECK-LABEL: define {{[^@]+}}@foo
66 ; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {
67 ; CHECK-NEXT: tail call void @omp_set_num_threads(i32 [[TMP0]])
68 ; CHECK-NEXT: tail call void @omp_set_num_threads(i32 [[TMP1]])
69 ; CHECK-NEXT: tail call void @use(i32 [[TMP1]])
70 ; CHECK-NEXT: tail call void @use(i32 [[TMP1]])
71 ; CHECK-NEXT: tail call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @[[GLOB0:[0-9]+]], i32 0, ptr @.omp_outlined.)
72 ; CHECK-NEXT: [[TMP3:%.*]] = tail call i32 @omp_get_max_threads()
73 ; CHECK-NEXT: tail call void @use(i32 [[TMP3]])
74 ; CHECK-NEXT: ret i32 0
76 tail call void @omp_set_num_threads(i32 %0)
77 %3 = tail call i32 @omp_get_max_threads()
78 ; FIXME: this value should be tracked and the rest of the getters deduplicated and replaced with it.
79 tail call void @omp_set_num_threads(i32 %1)
80 %4 = tail call i32 @omp_get_max_threads()
81 %5 = tail call i32 @omp_get_max_threads()
82 %6 = tail call i32 @omp_get_max_threads()
83 tail call void @use(i32 %4)
84 tail call void @use(i32 %5)
85 tail call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @0, i32 0, ptr @.omp_outlined.)
86 %7 = tail call i32 @omp_get_max_threads()
87 tail call void @use(i32 %7)
91 declare dso_local void @omp_set_num_threads(i32)
93 declare dso_local i32 @omp_get_max_threads()
95 declare dso_local void @use(i32)
96 declare dso_local void @no_openmp_use(i32) "no_openmp"
98 define internal void @.omp_outlined.(ptr %0, ptr %1) {
99 ; CHECK-LABEL: define {{[^@]+}}@.omp_outlined.
100 ; CHECK-SAME: (ptr [[TMP0:%.*]], ptr [[TMP1:%.*]]) {
101 ; CHECK-NEXT: [[TMP3:%.*]] = tail call i32 @omp_get_max_threads()
102 ; CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @omp_get_max_threads()
103 ; CHECK-NEXT: tail call void @use(i32 [[TMP4]])
104 ; CHECK-NEXT: tail call void @omp_set_num_threads(i32 10)
105 ; CHECK-NEXT: tail call void @use(i32 10)
106 ; CHECK-NEXT: ret void
108 ; FIXME: this value should be tracked and the rest of the getters deduplicated and replaced with it.
109 %3 = tail call i32 @omp_get_max_threads()
110 %4 = tail call i32 @omp_get_max_threads()
111 tail call void @use(i32 %4)
112 tail call void @omp_set_num_threads(i32 10)
113 %5 = tail call i32 @omp_get_max_threads()
114 tail call void @use(i32 %5)
118 declare !callback !0 void @__kmpc_fork_call(ptr, i32, ptr, ...)
120 define dso_local i32 @bar(i32 %0, i32 %1) {
121 ; CHECK-LABEL: define {{[^@]+}}@bar
122 ; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {
123 ; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]]
124 ; CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP0]], i32 [[TMP1]]
125 ; CHECK-NEXT: tail call void @omp_set_num_threads(i32 [[TMP4]])
126 ; CHECK-NEXT: tail call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @[[GLOB0]], i32 0, ptr @.omp_outlined..1)
127 ; CHECK-NEXT: [[TMP5:%.*]] = tail call i32 @omp_get_max_threads()
128 ; CHECK-NEXT: tail call void @use(i32 [[TMP5]])
129 ; CHECK-NEXT: ret i32 0
131 %3 = icmp sgt i32 %0, %1
132 %4 = select i1 %3, i32 %0, i32 %1
133 ; FIXME: getters can be replaced with %4
134 tail call void @omp_set_num_threads(i32 %4)
135 %5 = tail call i32 @omp_get_max_threads()
136 tail call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @0, i32 0, ptr @.omp_outlined..1)
137 %6 = tail call i32 @omp_get_max_threads()
138 tail call void @use(i32 %6)
142 define internal void @.omp_outlined..1(ptr %0, ptr %1) {
143 ; CHECK-LABEL: define {{[^@]+}}@.omp_outlined..1
144 ; CHECK-SAME: (ptr [[TMP0:%.*]], ptr [[TMP1:%.*]]) {
145 ; CHECK-NEXT: [[TMP3:%.*]] = tail call i32 @omp_get_max_threads()
146 ; CHECK-NEXT: tail call void @use(i32 [[TMP3]])
147 ; CHECK-NEXT: tail call void @omp_set_num_threads(i32 10)
148 ; CHECK-NEXT: tail call void @use(i32 10)
149 ; CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @omp_get_max_threads()
150 ; CHECK-NEXT: tail call void @use(i32 [[TMP4]])
151 ; CHECK-NEXT: ret void
153 %3 = tail call i32 @omp_get_max_threads()
154 tail call void @use(i32 %3)
155 tail call void @omp_set_num_threads(i32 10)
156 %4 = tail call i32 @omp_get_max_threads()
157 tail call void @use(i32 %4)
158 %5 = tail call i32 @omp_get_max_threads()
159 tail call void @use(i32 %5)
163 define dso_local i32 @bar1(i32 %0, i32 %1) {
164 ; CHECK-LABEL: define {{[^@]+}}@bar1
165 ; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {
166 ; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]]
167 ; CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP0]], i32 [[TMP1]]
168 ; CHECK-NEXT: tail call void @omp_set_num_threads(i32 [[TMP4]])
169 ; CHECK-NEXT: tail call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @[[GLOB0]], i32 0, ptr @.omp_outlined..2)
170 ; CHECK-NEXT: [[TMP5:%.*]] = tail call i32 @omp_get_max_threads()
171 ; CHECK-NEXT: tail call void @use(i32 [[TMP5]])
172 ; CHECK-NEXT: ret i32 0
174 %3 = icmp sgt i32 %0, %1
175 %4 = select i1 %3, i32 %0, i32 %1
176 tail call void @omp_set_num_threads(i32 %4)
177 %5 = tail call i32 @omp_get_max_threads()
178 tail call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @0, i32 0, ptr @.omp_outlined..2)
179 %6 = tail call i32 @omp_get_max_threads()
180 tail call void @use(i32 %6)
184 define internal void @.omp_outlined..2(ptr %0, ptr %1) {
185 ; CHECK-LABEL: define {{[^@]+}}@.omp_outlined..2
186 ; CHECK-SAME: (ptr [[TMP0:%.*]], ptr [[TMP1:%.*]]) {
187 ; CHECK-NEXT: [[TMP3:%.*]] = tail call i32 @omp_get_max_threads()
188 ; CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @icv_free_use(i32 [[TMP3]])
189 ; CHECK-NEXT: tail call void @omp_set_num_threads(i32 10)
190 ; CHECK-NEXT: [[TMP5:%.*]] = tail call i32 @icv_free_use(i32 10)
191 ; CHECK-NEXT: [[TMP6:%.*]] = tail call i32 @icv_free_use(i32 10)
192 ; CHECK-NEXT: ret void
194 %3 = tail call i32 @omp_get_max_threads()
195 %4 = tail call i32 @icv_free_use(i32 %3)
196 tail call void @omp_set_num_threads(i32 10)
197 %5 = tail call i32 @omp_get_max_threads()
198 %6 = tail call i32 @icv_free_use(i32 %5)
199 %7 = tail call i32 @omp_get_max_threads()
200 %8 = tail call i32 @icv_free_use(i32 %7)
203 define void @test(i1 %0) {
204 ; CHECK-LABEL: define {{[^@]+}}@test
205 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
206 ; CHECK-NEXT: call void @omp_set_num_threads(i32 2)
207 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false
208 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
210 ; CHECK-NEXT: call void @use(i32 10)
211 ; CHECK-NEXT: br label [[TMP4]]
213 ; CHECK-NEXT: [[TMP5:%.*]] = call i32 @omp_get_max_threads()
214 ; CHECK-NEXT: call void @use(i32 [[TMP5]])
215 ; CHECK-NEXT: ret void
217 call void @omp_set_num_threads(i32 2)
218 %2 = icmp eq i1 %0, 0
219 br i1 %2, label %4, label %3
222 call void @use(i32 10)
226 %5 = call i32 @omp_get_max_threads()
227 call void @use(i32 %5)
231 define void @test1(i1 %0) {
232 ; CHECK-LABEL: define {{[^@]+}}@test1
233 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
234 ; CHECK-NEXT: call void @omp_set_num_threads(i32 2)
235 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false
236 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
238 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @icv_free_use(i32 10)
239 ; CHECK-NEXT: br label [[TMP5]]
241 ; CHECK-NEXT: call void @use(i32 2)
242 ; CHECK-NEXT: ret void
244 call void @omp_set_num_threads(i32 2)
245 %2 = icmp eq i1 %0, 0
246 br i1 %2, label %5, label %3
249 %4 = call i32 @icv_free_use(i32 10)
253 %6 = call i32 @omp_get_max_threads()
254 call void @use(i32 %6)
258 define void @bad_use_test(i1 %0) {
259 ; CHECK-LABEL: define {{[^@]+}}@bad_use_test
260 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
261 ; CHECK-NEXT: call void @omp_set_num_threads(i32 2)
262 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false
263 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
265 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @bad_use(i32 10)
266 ; CHECK-NEXT: br label [[TMP5]]
268 ; CHECK-NEXT: [[TMP6:%.*]] = call i32 @omp_get_max_threads()
269 ; CHECK-NEXT: call void @use(i32 [[TMP6]])
270 ; CHECK-NEXT: ret void
272 call void @omp_set_num_threads(i32 2)
273 %2 = icmp eq i1 %0, 0
274 br i1 %2, label %5, label %3
277 %4 = call i32 @bad_use(i32 10)
281 %6 = call i32 @omp_get_max_threads()
282 call void @use(i32 %6)
286 define void @ok_use_assume_test(i1 %0) {
287 ; CHECK-LABEL: define {{[^@]+}}@ok_use_assume_test
288 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
289 ; CHECK-NEXT: call void @omp_set_num_threads(i32 2)
290 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false
291 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
293 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @ok_use_assume(i32 10)
294 ; CHECK-NEXT: br label [[TMP5]]
296 ; CHECK-NEXT: call void @use(i32 2)
297 ; CHECK-NEXT: ret void
299 call void @omp_set_num_threads(i32 2)
300 %2 = icmp eq i1 %0, 0
301 br i1 %2, label %5, label %3
304 %4 = call i32 @ok_use_assume(i32 10)
308 %6 = call i32 @omp_get_max_threads()
309 call void @use(i32 %6)
313 define weak void @weak_known_unique_icv(i1 %0) {
314 ; CHECK-LABEL: define {{[^@]+}}@weak_known_unique_icv
315 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
316 ; CHECK-NEXT: call void @omp_set_num_threads(i32 2)
317 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false
318 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
320 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @icv_free_use(i32 10)
321 ; CHECK-NEXT: br label [[TMP5]]
323 ; CHECK-NEXT: [[TMP6:%.*]] = call i32 @omp_get_max_threads()
324 ; CHECK-NEXT: [[TMP7:%.*]] = call i32 @icv_free_use(i32 [[TMP6]])
325 ; CHECK-NEXT: ret void
327 call void @omp_set_num_threads(i32 2)
328 %2 = icmp eq i1 %0, 0
329 br i1 %2, label %5, label %3
332 %4 = call i32 @icv_free_use(i32 10)
336 %6 = call i32 @omp_get_max_threads()
337 %7 = call i32 @icv_free_use(i32 %6)
341 define void @known_unique_icv(i1 %0) {
342 ; CHECK-LABEL: define {{[^@]+}}@known_unique_icv
343 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
344 ; CHECK-NEXT: call void @omp_set_num_threads(i32 2)
345 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false
346 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
348 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @icv_free_use(i32 10)
349 ; CHECK-NEXT: br label [[TMP5]]
351 ; CHECK-NEXT: [[TMP6:%.*]] = call i32 @icv_free_use(i32 2)
352 ; CHECK-NEXT: ret void
354 call void @omp_set_num_threads(i32 2)
355 %2 = icmp eq i1 %0, 0
356 br i1 %2, label %5, label %3
359 %4 = call i32 @icv_free_use(i32 10)
363 %6 = call i32 @omp_get_max_threads()
364 %7 = call i32 @icv_free_use(i32 %6)
368 define i32 @no_unique_icv(i1 %0) {
369 ; CHECK-LABEL: define {{[^@]+}}@no_unique_icv
370 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
371 ; CHECK-NEXT: call void @omp_set_num_threads(i32 4)
372 ; CHECK-NEXT: br i1 [[TMP0]], label [[TMP3:%.*]], label [[TMP2:%.*]]
374 ; CHECK-NEXT: call void @omp_set_num_threads(i32 2)
375 ; CHECK-NEXT: br label [[TMP3]]
377 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @omp_get_max_threads()
378 ; CHECK-NEXT: ret i32 [[TMP4]]
380 call void @omp_set_num_threads(i32 4)
381 br i1 %0, label %3, label %2
384 call void @omp_set_num_threads(i32 2)
388 %4 = call i32 @omp_get_max_threads()
392 define void @test2(i1 %0) {
393 ; CHECK-LABEL: define {{[^@]+}}@test2
394 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
395 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false
396 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
398 ; CHECK-NEXT: call void @omp_set_num_threads(i32 4)
399 ; CHECK-NEXT: br label [[TMP4]]
401 ; CHECK-NEXT: [[TMP5:%.*]] = call i32 @omp_get_max_threads()
402 ; CHECK-NEXT: call void @use(i32 [[TMP5]])
403 ; CHECK-NEXT: ret void
405 %2 = icmp eq i1 %0, 0
406 br i1 %2, label %4, label %3
409 call void @omp_set_num_threads(i32 4)
413 %5 = call i32 @omp_get_max_threads()
414 call void @use(i32 %5)
418 define void @test3(i1 %0) {
419 ; CHECK-LABEL: define {{[^@]+}}@test3
420 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
421 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false
422 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
424 ; CHECK-NEXT: call void @omp_set_num_threads(i32 4)
425 ; CHECK-NEXT: br label [[TMP4]]
427 ; CHECK-NEXT: call void @weak_known_unique_icv(i1 [[TMP0]])
428 ; CHECK-NEXT: [[TMP5:%.*]] = call i32 @omp_get_max_threads()
429 ; CHECK-NEXT: [[TMP6:%.*]] = call i32 @icv_free_use(i32 [[TMP5]])
430 ; CHECK-NEXT: ret void
432 %2 = icmp eq i1 %0, 0
433 br i1 %2, label %4, label %3
436 call void @omp_set_num_threads(i32 4)
440 call void @weak_known_unique_icv(i1 %0)
441 %5 = call i32 @omp_get_max_threads()
442 %6 = call i32 @icv_free_use(i32 %5)
446 declare void @__cxa_rethrow()
448 define i32 @maybe_throw(i1 zeroext %0) {
449 ; CHECK-LABEL: define {{[^@]+}}@maybe_throw
450 ; CHECK-SAME: (i1 zeroext [[TMP0:%.*]]) {
451 ; CHECK-NEXT: call void @omp_set_num_threads(i32 4) #[[ATTR0:[0-9]+]]
452 ; CHECK-NEXT: br i1 [[TMP0]], label [[TMP2:%.*]], label [[TMP3:%.*]]
454 ; CHECK-NEXT: tail call void @__cxa_rethrow()
455 ; CHECK-NEXT: unreachable
457 ; CHECK-NEXT: ret i32 -1
459 call void @omp_set_num_threads(i32 4)
460 br i1 %0, label %2, label %3
463 tail call void @__cxa_rethrow() #1
470 define void @test4(i1 %0) {
471 ; CHECK-LABEL: define {{[^@]+}}@test4
472 ; CHECK-SAME: (i1 [[TMP0:%.*]]) {
473 ; CHECK-NEXT: call void @known_unique_icv(i1 [[TMP0]])
474 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false
475 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
477 ; CHECK-NEXT: [[VAL:%.*]] = call i32 @icv_free_use(i32 10)
478 ; CHECK-NEXT: br label [[TMP4]]
480 ; CHECK-NEXT: call void @use(i32 2)
481 ; CHECK-NEXT: [[TMP5:%.*]] = call i32 @omp_get_max_threads()
482 ; CHECK-NEXT: [[TMP6:%.*]] = call i32 @no_unique_icv(i1 [[TMP0]])
483 ; CHECK-NEXT: call void @use(i32 [[TMP5]])
484 ; CHECK-NEXT: ret void
486 call void @known_unique_icv(i1 %0)
487 %2 = icmp eq i1 %0, 0
488 br i1 %2, label %4, label %3
491 %val = call i32 @icv_free_use(i32 10)
495 %5 = call i32 @omp_get_max_threads()
496 call void @use(i32 %5)
497 %6 = call i32 @omp_get_max_threads()
498 call i32 @no_unique_icv(i1 %0)
499 call void @use(i32 %6)
503 define void @test4_invoke(i1 %0) personality ptr @__gxx_personality_v0 {
504 ; CHECK-LABEL: define {{[^@]+}}@test4_invoke
505 ; CHECK-SAME: (i1 [[TMP0:%.*]]) personality ptr @__gxx_personality_v0 {
506 ; CHECK-NEXT: call void @known_unique_icv(i1 [[TMP0]])
507 ; CHECK-NEXT: [[TMP2:%.*]] = invoke i32 @maybe_throw(i1 zeroext [[TMP0]])
508 ; CHECK-NEXT: to label [[CONT:%.*]] unwind label [[EXC:%.*]]
510 ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i1 [[TMP0]], false
511 ; CHECK-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]]
513 ; CHECK-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
514 ; CHECK-NEXT: filter [0 x ptr] zeroinitializer
515 ; CHECK-NEXT: unreachable
517 ; CHECK-NEXT: [[VAL:%.*]] = call i32 @icv_free_use(i32 10)
518 ; CHECK-NEXT: br label [[TMP5]]
520 ; CHECK-NEXT: call void @use(i32 2)
521 ; CHECK-NEXT: ret void
523 call void @known_unique_icv(i1 %0)
524 invoke i32 @maybe_throw(i1 zeroext %0)
525 to label %cont unwind label %exc
528 %3 = icmp eq i1 %0, 0
529 br i1 %3, label %5, label %4
532 %lp = landingpad { ptr, i32 }
533 filter [0 x ptr] zeroinitializer
537 %val = call i32 @icv_free_use(i32 10)
541 %6 = call i32 @omp_get_max_threads()
542 call void @use(i32 %6)
546 define i32 @test5(i32 %0) #0 {
547 ; CHECK-LABEL: define {{[^@]+}}@test5
548 ; CHECK-SAME: (i32 [[TMP0:%.*]]) {
549 ; CHECK-NEXT: call void @omp_set_num_threads(i32 4)
550 ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP0]], 3
551 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
553 ; CHECK-NEXT: call void @use(i32 4)
554 ; CHECK-NEXT: br label [[TMP12:%.*]]
556 ; CHECK-NEXT: [[TMP5:%.*]] = icmp sgt i32 [[TMP0]], 0
557 ; CHECK-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP8:%.*]]
559 ; CHECK-NEXT: [[TMP7:%.*]] = call i32 @icv_free_use(i32 [[TMP0]])
560 ; CHECK-NEXT: br label [[TMP15:%.*]]
562 ; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP0]], 0
563 ; CHECK-NEXT: br i1 [[TMP9]], label [[TMP10:%.*]], label [[TMP12]]
565 ; CHECK-NEXT: [[TMP11:%.*]] = call i32 @icv_free_use(i32 10)
566 ; CHECK-NEXT: br label [[TMP15]]
568 ; CHECK-NEXT: [[TMP13:%.*]] = add nsw i32 [[TMP0]], 1
569 ; CHECK-NEXT: [[TMP14:%.*]] = call i32 @icv_free_use(i32 [[TMP13]])
570 ; CHECK-NEXT: br label [[TMP15]]
572 ; CHECK-NEXT: [[TMP16:%.*]] = call i32 @omp_get_max_threads()
573 ; CHECK-NEXT: [[TMP17:%.*]] = call i32 @icv_free_use(i32 [[TMP16]])
574 ; CHECK-NEXT: ret i32 [[TMP17]]
576 call void @omp_set_num_threads(i32 4)
577 %2 = icmp sgt i32 %0, 3
578 br i1 %2, label %3, label %5
581 %4 = call i32 @omp_get_max_threads()
582 call void @use(i32 %4)
586 %6 = icmp sgt i32 %0, 0
587 br i1 %6, label %7, label %9
590 %8 = call i32 @icv_free_use(i32 %0)
594 %10 = icmp eq i32 %0, 0
595 br i1 %10, label %11, label %13
598 %12 = call i32 @icv_free_use(i32 10)
602 %14 = add nsw i32 %0, 1
603 %15 = call i32 @icv_free_use(i32 %14)
607 %17 = call i32 @omp_get_max_threads()
608 %18 = call i32 @icv_free_use(i32 %17)
612 define i32 @test6(i32 %0) {
613 ; CHECK-LABEL: define {{[^@]+}}@test6
614 ; CHECK-SAME: (i32 [[TMP0:%.*]]) {
615 ; CHECK-NEXT: call void @omp_set_num_threads(i32 4)
616 ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP0]], 3
617 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP5:%.*]]
619 ; CHECK-NEXT: [[TMP4:%.*]] = call i32 @icv_free_use(i32 10)
620 ; CHECK-NEXT: br label [[TMP16:%.*]]
622 ; CHECK-NEXT: [[TMP6:%.*]] = icmp sgt i32 [[TMP0]], 0
623 ; CHECK-NEXT: br i1 [[TMP6]], label [[TMP7:%.*]], label [[TMP9:%.*]]
625 ; CHECK-NEXT: [[TMP8:%.*]] = call i32 @icv_free_use(i32 [[TMP0]])
626 ; CHECK-NEXT: br label [[TMP16]]
628 ; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i32 [[TMP0]], 0
629 ; CHECK-NEXT: br i1 [[TMP10]], label [[TMP11:%.*]], label [[TMP13:%.*]]
631 ; CHECK-NEXT: [[TMP12:%.*]] = call i32 @icv_free_use(i32 5)
632 ; CHECK-NEXT: br label [[TMP16]]
634 ; CHECK-NEXT: [[TMP14:%.*]] = add nsw i32 [[TMP0]], 1
635 ; CHECK-NEXT: [[TMP15:%.*]] = call i32 @icv_free_use(i32 [[TMP14]])
636 ; CHECK-NEXT: br label [[TMP16]]
638 ; CHECK-NEXT: [[TMP17:%.*]] = call i32 @icv_free_use(i32 4)
639 ; CHECK-NEXT: ret i32 [[TMP17]]
641 call void @omp_set_num_threads(i32 4)
642 %2 = icmp sgt i32 %0, 3
643 br i1 %2, label %3, label %5
646 %4 = call i32 @icv_free_use(i32 10)
650 %6 = icmp sgt i32 %0, 0
651 br i1 %6, label %7, label %9
654 %8 = call i32 @icv_free_use(i32 %0)
658 %10 = icmp eq i32 %0, 0
659 br i1 %10, label %11, label %13
662 %12 = call i32 @icv_free_use(i32 5)
666 %14 = add nsw i32 %0, 1
667 %15 = call i32 @icv_free_use(i32 %14)
670 16: ; preds = %7, %13, %11, %3
671 %17 = call i32 @omp_get_max_threads()
672 %18 = call i32 @icv_free_use(i32 %17)
676 declare i32 @__gxx_personality_v0(...)
678 !llvm.module.flags = !{!2}
681 !1 = !{i64 2, i64 -1, i64 -1, i1 true}
682 !2 = !{i32 7, !"openmp", i32 50}