Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / sections_ast_print.cpp
blob4759b4df0849d52db1e43d999717b830dcbfd645
1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
8 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
13 void foo() {}
15 template <class T, int N>
16 T tmain(T argc) {
17 T b = argc, c, d, e, f, g;
18 static T a;
19 // CHECK: static T a;
20 #pragma omp parallel
21 #pragma omp sections private(argc, b), firstprivate(c, d), lastprivate(d, f) reduction(task, - : g) nowait allocate(d)
23 foo();
25 // CHECK-NEXT: #pragma omp parallel
26 // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(c,d) lastprivate(d,f) reduction(task, -: g) nowait allocate(d){{$}}
27 // CHECK-NEXT: {
28 // CHECK-NEXT: foo();
29 // CHECK-NEXT: }
30 return T();
33 int main(int argc, char **argv) {
34 // CHECK: int main(int argc, char **argv) {
35 int b = argc, c, d, e, f, g;
36 static int a;
37 // CHECK: static int a;
38 #pragma omp parallel
39 #pragma omp sections allocate(c) private(argc, b), firstprivate(argv, c), lastprivate(d, f) reduction(+ : g) nowait
41 #pragma omp section
42 foo();
43 #pragma omp section
44 foo();
46 // CHECK-NEXT: #pragma omp parallel
47 // CHECK-NEXT: #pragma omp sections allocate(c) private(argc,b) firstprivate(argv,c) lastprivate(d,f) reduction(+: g) nowait
48 // CHECK-NEXT: {
49 // CHECK-NEXT: #pragma omp section{{$}}
50 // CHECK-NEXT: foo();
51 // CHECK-NEXT: #pragma omp section
52 // CHECK-NEXT: foo();
53 // CHECK-NEXT: }
54 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
57 #endif