1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function main --scrub-attributes --filter "@omp_get_thread_limit|@use" --version 4
2 ; RUN: opt -passes=openmp-opt-cgscc -S < %s | FileCheck %s
4 declare void @use(i32 noundef)
5 declare i32 @omp_get_thread_limit()
6 declare void @__kmpc_set_thread_limit(ptr, i32, i32)
7 declare i32 @__kmpc_global_thread_num(ptr)
8 declare noalias ptr @__kmpc_omp_task_alloc(ptr, i32, i32, i64, i64, ptr)
9 declare void @__kmpc_omp_task_complete_if0(ptr, i32, ptr)
10 declare void @__kmpc_omp_task_begin_if0(ptr, i32, ptr)
12 %struct.ident_t = type { i32, i32, i32, i32, ptr }
14 @0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
15 @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8
17 define i32 @main() local_unnamed_addr {
18 ; CHECK-LABEL: define i32 @main() local_unnamed_addr {
19 ; CHECK: [[CALL_I_I_I:%.*]] = call i32 @omp_get_thread_limit()
20 ; CHECK: call void @use(i32 noundef [[CALL_I_I_I]])
21 ; CHECK: [[CALL_I_I_I2:%.*]] = call i32 @omp_get_thread_limit()
22 ; CHECK: call void @use(i32 noundef [[CALL_I_I_I2]])
25 %0 = call i32 @__kmpc_global_thread_num(ptr nonnull @1)
26 %1 = call ptr @__kmpc_omp_task_alloc(ptr nonnull @1, i32 %0, i32 1, i64 40, i64 0, ptr nonnull @.omp_task_entry.)
27 call void @__kmpc_omp_task_begin_if0(ptr nonnull @1, i32 %0, ptr %1)
28 call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 4)
29 %call.i.i.i = call i32 @omp_get_thread_limit()
30 call void @use(i32 noundef %call.i.i.i)
31 call void @__kmpc_omp_task_complete_if0(ptr nonnull @1, i32 %0, ptr %1)
32 %2 = call ptr @__kmpc_omp_task_alloc(ptr nonnull @1, i32 %0, i32 1, i64 40, i64 0, ptr nonnull @.omp_task_entry..2)
33 call void @__kmpc_omp_task_begin_if0(ptr nonnull @1, i32 %0, ptr %2)
34 call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 3)
35 %call.i.i.i2 = call i32 @omp_get_thread_limit()
36 call void @use(i32 noundef %call.i.i.i2)
37 call void @__kmpc_omp_task_complete_if0(ptr nonnull @1, i32 %0, ptr %2)
41 define internal noundef i32 @.omp_task_entry.(i32 noundef %0, ptr noalias nocapture noundef readonly %1) {
43 tail call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 4)
44 %call.i.i = tail call i32 @omp_get_thread_limit()
45 tail call void @use(i32 noundef %call.i.i)
49 define internal noundef i32 @.omp_task_entry..2(i32 noundef %0, ptr noalias nocapture noundef readonly %1) {
51 tail call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 3)
52 %call.i.i = tail call i32 @omp_get_thread_limit()
53 tail call void @use(i32 noundef %call.i.i)
57 !llvm.module.flags = !{!0}
59 !0 = !{i32 7, !"openmp", i32 51}