1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt -S -passes=openmp-opt-cgscc < %s | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6 @inofth = external global i32, align 4
9 ; CHECK-LABEL: define {{[^@]+}}@set() {
11 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr @inofth, align 4
12 ; CHECK-NEXT: call void @omp_set_num_threads(i32 noundef [[TMP0]])
13 ; CHECK-NEXT: ret void
16 %0 = load i32, ptr @inofth, align 4
17 call void @omp_set_num_threads(i32 noundef %0)
21 define i32 @test(i32 %a) {
22 ; CHECK-LABEL: define {{[^@]+}}@test
23 ; CHECK-SAME: (i32 [[A:%.*]]) {
25 ; CHECK-NEXT: call void @set()
26 ; CHECK-NEXT: [[CALL:%.*]] = call i32 @omp_get_max_threads()
27 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[CALL]], [[A]]
28 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
30 ; CHECK-NEXT: ret i32 0
32 ; CHECK-NEXT: ret i32 1
36 %call = call i32 @omp_get_max_threads()
37 %cmp = icmp ne i32 %call, %a
38 br i1 %cmp, label %if.then, label %if.end
40 if.then: ; preds = %entry
43 if.end: ; preds = %if.then, %entry
47 declare void @omp_set_num_threads(i32 noundef)
48 declare i32 @omp_get_max_threads()
50 !llvm.module.flags = !{!0}
52 !0 = !{i32 7, !"openmp", i32 50}