Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_enter_data_ast_print_openmp52.cpp
blob578f9a25427440e322f7523d1ba92ec2a30463c1
1 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck --check-prefix=CHECK --check-prefix=CHECK-52 %s
5 // expected-no-diagnostics
7 #ifndef HEADER
8 #define HEADER
10 template <typename T, int C>
11 T tmain(T argc, T *argv) {
12 T i_def, i;
14 i = argc;
16 #pragma omp target enter data map(i_def)
18 #pragma omp target enter data map(to: i)
20 return 0;
23 // CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
24 // CHECK-NEXT: T i_def, i;
25 // CHECK-NEXT: i = argc;
26 // CHECK-NEXT: #pragma omp target enter data map(to: i_def){{$}}
27 // CHECK-NEXT: #pragma omp target enter data map(to: i){{$}}
29 // CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
30 // CHECK-NEXT: int i_def, i;
31 // CHECK-NEXT: i = argc;
32 // CHECK-NEXT: #pragma omp target enter data map(to: i_def){{$}}
33 // CHECK-NEXT: #pragma omp target enter data map(to: i)
35 // CHECK: template<> char tmain<char, 1>(char argc, char *argv) {
36 // CHECK-NEXT: char i_def, i;
37 // CHECK-NEXT: i = argc;
38 // CHECK-NEXT: #pragma omp target enter data map(to: i_def){{$}}
39 // CHECK-NEXT: #pragma omp target enter data map(to: i)
41 int main (int argc, char **argv) {
42 int b_def, b;
43 static int a_def, a;
44 // CHECK: static int a_def, a;
46 #pragma omp target enter data map(a_def)
47 // CHECK: #pragma omp target enter data map(to: a_def)
48 a_def=2;
49 // CHECK-NEXT: a_def = 2;
51 #pragma omp target enter data map(to: a)
52 // CHECK: #pragma omp target enter data map(to: a)
53 a=2;
54 // CHECK-NEXT: a = 2;
56 #pragma omp target enter data map(b_def)
57 // CHECK-NEXT: #pragma omp target enter data map(to: b_def)
59 #pragma omp target enter data map(to: b)
60 // CHECK-NEXT: #pragma omp target enter data map(to: b)
62 return tmain<int, 5>(argc, &argc) + tmain<char, 1>(argv[0][0], argv[0]);
65 #endif