[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / parallel_masked.cpp
blobb4bb036d12ed70baead860246c516beadec58d4d
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --prefix-filecheck-ir-name _
2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -fopenmp-version=52 -x c -emit-llvm %s -o - | FileCheck %s
3 // expected-no-diagnostics
5 void foo();
7 void masked() {
8 #pragma omp parallel masked
10 foo();
14 void maskedFilter() {
15 const int tid = 1;
16 #pragma omp parallel masked filter(tid)
18 foo();
22 void master() {
23 #pragma omp parallel master
25 foo();
28 // CHECK-LABEL: define {{[^@]+}}@masked
29 // CHECK-SAME: () #[[ATTR0:[0-9]+]] {
30 // CHECK-NEXT: entry:
31 // CHECK-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1:[0-9]+]], i32 0, ptr @masked.omp_outlined)
32 // CHECK-NEXT: ret void
35 // CHECK-LABEL: define {{[^@]+}}@masked.omp_outlined
36 // CHECK-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR1:[0-9]+]] {
37 // CHECK-NEXT: entry:
38 // CHECK-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
39 // CHECK-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
40 // CHECK-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
41 // CHECK-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
42 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
43 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
44 // CHECK-NEXT: [[TMP2:%.*]] = call i32 @__kmpc_masked(ptr @[[GLOB1]], i32 [[TMP1]], i32 0)
45 // CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], 0
46 // CHECK-NEXT: br i1 [[TMP3]], label [[OMP_IF_THEN:%.*]], label [[OMP_IF_END:%.*]]
47 // CHECK: omp_if.then:
48 // CHECK-NEXT: call void (...) @foo()
49 // CHECK-NEXT: call void @__kmpc_end_masked(ptr @[[GLOB1]], i32 [[TMP1]])
50 // CHECK-NEXT: br label [[OMP_IF_END]]
51 // CHECK: omp_if.end:
52 // CHECK-NEXT: ret void
55 // CHECK-LABEL: define {{[^@]+}}@maskedFilter
56 // CHECK-SAME: () #[[ATTR0]] {
57 // CHECK-NEXT: entry:
58 // CHECK-NEXT: [[TID:%.*]] = alloca i32, align 4
59 // CHECK-NEXT: store i32 1, ptr [[TID]], align 4
60 // CHECK-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 0, ptr @maskedFilter.omp_outlined)
61 // CHECK-NEXT: ret void
64 // CHECK-LABEL: define {{[^@]+}}@maskedFilter.omp_outlined
65 // CHECK-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR1]] {
66 // CHECK-NEXT: entry:
67 // CHECK-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
68 // CHECK-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
69 // CHECK-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
70 // CHECK-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
71 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
72 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
73 // CHECK-NEXT: [[TMP2:%.*]] = call i32 @__kmpc_masked(ptr @[[GLOB1]], i32 [[TMP1]], i32 1)
74 // CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], 0
75 // CHECK-NEXT: br i1 [[TMP3]], label [[OMP_IF_THEN:%.*]], label [[OMP_IF_END:%.*]]
76 // CHECK: omp_if.then:
77 // CHECK-NEXT: call void (...) @foo()
78 // CHECK-NEXT: call void @__kmpc_end_masked(ptr @[[GLOB1]], i32 [[TMP1]])
79 // CHECK-NEXT: br label [[OMP_IF_END]]
80 // CHECK: omp_if.end:
81 // CHECK-NEXT: ret void
84 // CHECK-LABEL: define {{[^@]+}}@master
85 // CHECK-SAME: () #[[ATTR0]] {
86 // CHECK-NEXT: entry:
87 // CHECK-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 0, ptr @master.omp_outlined)
88 // CHECK-NEXT: ret void
91 // CHECK-LABEL: define {{[^@]+}}@master.omp_outlined
92 // CHECK-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR1]] {
93 // CHECK-NEXT: entry:
94 // CHECK-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
95 // CHECK-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
96 // CHECK-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
97 // CHECK-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
98 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
99 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
100 // CHECK-NEXT: [[TMP2:%.*]] = call i32 @__kmpc_master(ptr @[[GLOB1]], i32 [[TMP1]])
101 // CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], 0
102 // CHECK-NEXT: br i1 [[TMP3]], label [[OMP_IF_THEN:%.*]], label [[OMP_IF_END:%.*]]
103 // CHECK: omp_if.then:
104 // CHECK-NEXT: call void (...) @foo()
105 // CHECK-NEXT: call void @__kmpc_end_master(ptr @[[GLOB1]], i32 [[TMP1]])
106 // CHECK-NEXT: br label [[OMP_IF_END]]
107 // CHECK: omp_if.end:
108 // CHECK-NEXT: ret void