|
| 1 | +; RUN: opt -passes=openmp-opt-cgscc -S < %s | FileCheck %s |
| 2 | + |
| 3 | +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" |
| 4 | + |
| 5 | +declare i32 @printf(ptr noundef, ...) |
| 6 | +declare i32 @omp_get_thread_limit() |
| 7 | +; Function Attrs: nounwind |
| 8 | +declare void @__kmpc_set_thread_limit(ptr, i32, i32) |
| 9 | +; Function Attrs: nounwind |
| 10 | +declare i32 @__kmpc_global_thread_num(ptr) |
| 11 | +; Function Attrs: nounwind |
| 12 | +declare noalias ptr @__kmpc_omp_task_alloc(ptr, i32, i32, i64, i64, ptr) |
| 13 | +; Function Attrs: nounwind |
| 14 | +declare void @__kmpc_omp_task_complete_if0(ptr, i32, ptr) |
| 15 | +; Function Attrs: nounwind |
| 16 | +declare void @__kmpc_omp_task_begin_if0(ptr, i32, ptr) |
| 17 | + |
| 18 | +%struct.ident_t = type { i32, i32, i32, i32, ptr } |
| 19 | + |
| 20 | +@.str = private unnamed_addr constant [28 x i8] c"\0A1:target thread_limit: %d\0A\00", align 1 |
| 21 | +@0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1 |
| 22 | +@1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 22, ptr @0 }, align 8 |
| 23 | +@.str.1 = private unnamed_addr constant [28 x i8] c"\0A2:target thread_limit: %d\0A\00", align 1 |
| 24 | + |
| 25 | +define dso_local i32 @main() local_unnamed_addr { |
| 26 | +; CHECK-LABEL: define {{[^@]+}}@main |
| 27 | +; CHECK-NEXT: entry: |
| 28 | +; CHECK: %call.i.i.i = call i32 @omp_get_thread_limit() |
| 29 | +; CHECK-NEXT: %call1.i.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %call.i.i.i) |
| 30 | +; CHECK: %call.i.i.i1 = call i32 @omp_get_thread_limit() |
| 31 | +; CHECK-NEXT: %call1.i.i.i2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call.i.i.i1) |
| 32 | +entry: |
| 33 | + %0 = call i32 @__kmpc_global_thread_num(ptr nonnull @1) |
| 34 | + %1 = call ptr @__kmpc_omp_task_alloc(ptr nonnull @1, i32 %0, i32 1, i64 40, i64 0, ptr nonnull @.omp_task_entry.) |
| 35 | + call void @__kmpc_omp_task_begin_if0(ptr nonnull @1, i32 %0, ptr %1) |
| 36 | + call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 4) |
| 37 | + %call.i.i.i = call i32 @omp_get_thread_limit() |
| 38 | + %call1.i.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %call.i.i.i) |
| 39 | + call void @__kmpc_omp_task_complete_if0(ptr nonnull @1, i32 %0, ptr %1) |
| 40 | + %2 = call ptr @__kmpc_omp_task_alloc(ptr nonnull @1, i32 %0, i32 1, i64 40, i64 0, ptr nonnull @.omp_task_entry..3) |
| 41 | + call void @__kmpc_omp_task_begin_if0(ptr nonnull @1, i32 %0, ptr %2) |
| 42 | + call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 3) |
| 43 | + %call.i.i.i1 = call i32 @omp_get_thread_limit() |
| 44 | + %call1.i.i.i2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call.i.i.i1) |
| 45 | + call void @__kmpc_omp_task_complete_if0(ptr nonnull @1, i32 %0, ptr %2) |
| 46 | + ret i32 0 |
| 47 | +} |
| 48 | + |
| 49 | +define internal noundef i32 @.omp_task_entry.(i32 noundef %0, ptr noalias nocapture noundef readonly %1) { |
| 50 | +entry: |
| 51 | + tail call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 4) |
| 52 | + %call.i.i = tail call i32 @omp_get_thread_limit() |
| 53 | + %call1.i.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %call.i.i) |
| 54 | + ret i32 0 |
| 55 | +} |
| 56 | + |
| 57 | +define internal noundef i32 @.omp_task_entry..3(i32 noundef %0, ptr noalias nocapture noundef readonly %1) { |
| 58 | +entry: |
| 59 | + tail call void @__kmpc_set_thread_limit(ptr nonnull @1, i32 %0, i32 3) |
| 60 | + %call.i.i = tail call i32 @omp_get_thread_limit() |
| 61 | + %call1.i.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %call.i.i) |
| 62 | + ret i32 0 |
| 63 | +} |
| 64 | + |
| 65 | +attributes #1 = { alwaysinline norecurse nounwind uwtable } |
| 66 | +attributes #3 = { alwaysinline nounwind uwtable } |
| 67 | + |
| 68 | +!llvm.module.flags = !{!0} |
| 69 | + |
| 70 | +!0 = !{i32 7, !"openmp", i32 51} |
0 commit comments