Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / taskloop_with_atomic_codegen.cpp
blobc01b3010884366c7922bb88c4e77cc00112438a2
1 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -x c++ -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
5 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp-simd -x c++ -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
8 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9 // expected-no-diagnostics
11 #ifndef HEADER
12 #define HEADER
14 // CHECK-LABEL: @main
15 int main() {
16 unsigned occupanices = 0;
18 // CHECK: call void @__kmpc_taskloop(ptr @{{.+}}, i32 %{{.+}}, ptr %{{.+}}, i32 1, ptr %{{.+}}, ptr %{{.+}}, i64 %{{.+}}, i32 1, i32 0, i64 0, ptr null)
19 #pragma omp taskloop
20 for (int i = 0; i < 1; i++) {
21 #pragma omp atomic
22 occupanices++;
26 // CHECK: define internal noundef i32 @{{.+}}(
27 // Check that occupanices var is firstprivatized.
28 // CHECK-DAG: atomicrmw add ptr [[FP_OCCUP:%.+]], i32 1 monotonic, align 4
29 // CHECK-DAG: [[FP_OCCUP]] = load ptr, ptr [[FP_OCCUP_ADDR:%[^,]+]],
30 // CHECK-DAG: call void %{{.*}}(ptr %{{.+}}, ptr [[FP_OCCUP_ADDR]])
32 #endif