Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / scan_ast_print.cpp
blob3bbd3b60c3e8c4e38aae551eeca77865a8e8c0b1
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>
16 T tmain(T argc) {
17 static T a;
18 #pragma omp for reduction(inscan, +: a)
19 for (int i = 0; i < 10; ++i) {
20 #pragma omp scan inclusive(a)
22 return a + argc;
24 // CHECK: static T a;
25 // CHECK-NEXT: #pragma omp for reduction(inscan, +: a)
26 // CHECK-NEXT: for (int i = 0; i < 10; ++i) {
27 // CHECK-NEXT: #pragma omp scan inclusive(a){{$}}
28 // CHECK: static int a;
29 // CHECK-NEXT: #pragma omp for reduction(inscan, +: a)
30 // CHECK-NEXT: for (int i = 0; i < 10; ++i) {
31 // CHECK-NEXT: #pragma omp scan inclusive(a)
32 // CHECK: static char a;
33 // CHECK-NEXT: #pragma omp for reduction(inscan, +: a)
34 // CHECK-NEXT: for (int i = 0; i < 10; ++i) {
35 // CHECK-NEXT: #pragma omp scan inclusive(a)
37 int main(int argc, char **argv) {
38 static int a;
39 // CHECK: static int a;
40 #pragma omp parallel
41 #pragma omp for simd reduction(inscan, ^: a, argc)
42 for (int i = 0; i < 10; ++i) {
43 #pragma omp scan exclusive(a, argc)
45 // CHECK-NEXT: #pragma omp parallel
46 // CHECK-NEXT: #pragma omp for simd reduction(inscan, ^: a,argc)
47 // CHECK-NEXT: for (int i = 0; i < 10; ++i) {
48 // CHECK-NEXT: #pragma omp scan exclusive(a,argc){{$}}
49 return tmain(argc) + tmain(argv[0][0]) + a;
52 #endif