blob: 4933bf31c2a5813a9f0220b622bf62b392f37055 [file] [log] [blame]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001// expected-no-diagnostics
2#ifndef HEADER
3#define HEADER
4
5///
6/// Implicit maps.
7///
8
9///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +000010// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
11// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
12// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
13// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
14// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
15// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +000016#ifdef CK1
17
18// CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000019// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
20// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000021
22// CK1-LABEL: implicit_maps_integer
23void implicit_maps_integer (int a){
24 int i = a;
25
26 // CK1-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
27 // CK1-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
28 // CK1-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
29 // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
30 // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +000031 // CK1-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
32 // CK1-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
33 // CK1-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
34 // CK1-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000035 // CK1-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
36 // CK1-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
37 // CK1-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
38
39 // CK1: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
40 #pragma omp target
41 {
42 ++i;
43 }
44}
45
46// CK1: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
47// CK1: [[ADDR:%.+]] = alloca i[[sz]],
48// CK1: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
49// CK1-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
50// CK1-64: {{.+}} = load i32, i32* [[CADDR]],
51// CK1-32: {{.+}} = load i32, i32* [[ADDR]],
52
53#endif
54///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +000055// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
56// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
57// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
58// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-32
59// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
60// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +000061#ifdef CK2
62
Samuel Antao403ffd42016-07-27 22:49:49 +000063// CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000064// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
Samuel Antao403ffd42016-07-27 22:49:49 +000065// CK2: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
66// CK2: [[SIZES2:@.+]] = {{.+}}constant [1 x i[[sz]]] zeroinitializer
67// Map types: OMP_MAP_IS_PTR = 32
68// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i32] [i32 32]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000069
Samuel Antao403ffd42016-07-27 22:49:49 +000070// CK2-LABEL: implicit_maps_reference
71void implicit_maps_reference (int a, int *b){
Samuel Antao4af1b7b2015-12-02 17:44:43 +000072 int &i = a;
73 // CK2-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
74 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
75 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
76 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
77 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +000078 // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
79 // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
80 // CK2-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
81 // CK2-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000082 // CK2-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
83 // CK2-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
84 // CK2-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
85
86 // CK2: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
87 #pragma omp target
88 {
89 ++i;
90 }
Samuel Antao403ffd42016-07-27 22:49:49 +000091
92 int *&p = b;
93 // CK2-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
94 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
95 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
96 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
97 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +000098 // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
99 // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
100 // CK2-DAG: store i32* [[VAL:%[^,]+]], i32** [[CBP1]]
101 // CK2-DAG: store i32* [[VAL]], i32** [[CP1]]
Samuel Antao403ffd42016-07-27 22:49:49 +0000102 // CK2-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]],
103 // CK2-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]],
104
105 // CK2: call void [[KERNEL2:@.+]](i32* [[VAL]])
106 #pragma omp target
107 {
108 ++p;
109 }
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000110}
111
112// CK2: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
113// CK2: [[ADDR:%.+]] = alloca i[[sz]],
114// CK2: [[REF:%.+]] = alloca i32*,
115// CK2: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
116// CK2-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
117// CK2-64: store i32* [[CADDR]], i32** [[REF]],
118// CK2-64: [[RVAL:%.+]] = load i32*, i32** [[REF]],
119// CK2-64: {{.+}} = load i32, i32* [[RVAL]],
120// CK2-32: store i32* [[ADDR]], i32** [[REF]],
121// CK2-32: [[RVAL:%.+]] = load i32*, i32** [[REF]],
122// CK2-32: {{.+}} = load i32, i32* [[RVAL]],
123
Samuel Antao403ffd42016-07-27 22:49:49 +0000124// CK2: define internal void [[KERNEL2]](i32* [[ARG:%.+]])
125// CK2: [[ADDR:%.+]] = alloca i32*,
126// CK2: [[REF:%.+]] = alloca i32**,
127// CK2: store i32* [[ARG]], i32** [[ADDR]],
128// CK2: store i32** [[ADDR]], i32*** [[REF]],
129// CK2: [[T:%.+]] = load i32**, i32*** [[REF]],
130// CK2: [[TT:%.+]] = load i32*, i32** [[T]],
131// CK2: getelementptr inbounds i32, i32* [[TT]], i32 1
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000132#endif
133///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000134// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-64
135// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
136// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-64
137// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-32
138// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
139// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000140#ifdef CK3
141
142// CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000143// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
144// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000145
146// CK3-LABEL: implicit_maps_parameter
147void implicit_maps_parameter (int a){
148
149 // CK3-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
150 // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
151 // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
152 // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
153 // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000154 // CK3-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
155 // CK3-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
156 // CK3-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
157 // CK3-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000158 // CK3-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
159 // CK3-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
160 // CK3-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
161
162 // CK3: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
163 #pragma omp target
164 {
165 ++a;
166 }
167}
168
169// CK3: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
170// CK3: [[ADDR:%.+]] = alloca i[[sz]],
171// CK3: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
172// CK3-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
173// CK3-64: {{.+}} = load i32, i32* [[CADDR]],
174// CK3-32: {{.+}} = load i32, i32* [[ADDR]],
175
176#endif
177///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000178// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-64
179// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
180// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-64
181// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-32
182// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
183// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000184#ifdef CK4
185
186// CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000187// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
188// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000189
190// CK4-LABEL: implicit_maps_nested_integer
191void implicit_maps_nested_integer (int a){
192 int i = a;
193
194 // The captures in parallel are by reference. Only the capture in target is by
195 // copy.
196
197 // CK4: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP1:@.+]] to void (i32*, i32*, ...)*), i32* {{.+}})
198 // CK4: define internal void [[KERNELP1]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
199 #pragma omp parallel
200 {
201 // CK4-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
202 // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
203 // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
204 // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
205 // CK4-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000206 // CK4-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
207 // CK4-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
208 // CK4-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
209 // CK4-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000210 // CK4-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
211 // CK4-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
212 // CK4-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
213
214 // CK4: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
215 #pragma omp target
216 {
217 #pragma omp parallel
218 {
219 ++i;
220 }
221 }
222 }
223}
224
225// CK4: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
226// CK4: [[ADDR:%.+]] = alloca i[[sz]],
227// CK4: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
228// CK4-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
229// CK4-64: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[CADDR]])
230// CK4-32: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[ADDR]])
231// CK4: define internal void [[KERNELP2]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
232#endif
233///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000234// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-64
235// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
236// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-64
237// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-32
238// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
239// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000240#ifdef CK5
241
242// CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000243// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
244// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000245
246// CK5-LABEL: implicit_maps_nested_integer_and_enum
247void implicit_maps_nested_integer_and_enum (int a){
248 enum Bla {
249 SomeEnum = 0x09
250 };
251
252 // Using an enum should not change the mapping information.
253 int i = a;
254
255 // CK5-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
256 // CK5-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
257 // CK5-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
258 // CK5-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
259 // CK5-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000260 // CK5-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
261 // CK5-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
262 // CK5-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
263 // CK5-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000264 // CK5-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
265 // CK5-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
266 // CK5-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
267
268 // CK5: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
269 #pragma omp target
270 {
271 ++i;
272 i += SomeEnum;
273 }
274}
275
276// CK5: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
277// CK5: [[ADDR:%.+]] = alloca i[[sz]],
278// CK5: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
279// CK5-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
280// CK5-64: {{.+}} = load i32, i32* [[CADDR]],
281// CK5-32: {{.+}} = load i32, i32* [[ADDR]],
282
283#endif
284///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000285// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-64
286// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
287// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-64
288// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-32
289// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
290// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000291#ifdef CK6
292// CK6-DAG: [[GBL:@Gi]] = global i32 0
293// CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000294// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
295// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000296
297// CK6-LABEL: implicit_maps_host_global
298int Gi;
299void implicit_maps_host_global (int a){
300 // CK6-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
301 // CK6-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
302 // CK6-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
303 // CK6-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
304 // CK6-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000305 // CK6-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
306 // CK6-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
307 // CK6-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
308 // CK6-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000309 // CK6-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
310 // CK6-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
311 // CK6-64-DAG: store i32 [[GBLVAL:%.+]], i32* [[CADDR]],
312 // CK6-64-DAG: [[GBLVAL]] = load i32, i32* [[GBL]],
313 // CK6-32-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[GBLVAL:%.+]],
314
315 // CK6: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
316 #pragma omp target
317 {
318 ++Gi;
319 }
320}
321
322// CK6: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
323// CK6: [[ADDR:%.+]] = alloca i[[sz]],
324// CK6: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
325// CK6-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
326// CK6-64: {{.+}} = load i32, i32* [[CADDR]],
327// CK6-32: {{.+}} = load i32, i32* [[ADDR]],
328
329#endif
330///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000331// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-64
332// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
333// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-64
334// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-32
335// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
336// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000337#ifdef CK7
338
339// For a 32-bit targets, the value doesn't fit the size of the pointer,
340// therefore it is passed by reference with a map 'to' specification.
341
342// CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000343// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
344// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
345// Map types: OMP_MAP_TO | OMP_MAP_IS_FIRST = 33
346// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000347
348// CK7-LABEL: implicit_maps_double
349void implicit_maps_double (int a){
350 double d = (double)a;
351
352 // CK7-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
353 // CK7-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
354 // CK7-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
355 // CK7-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
356 // CK7-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
357
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000358 // CK7-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
359 // CK7-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
360 // CK7-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
361 // CK7-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000362 // CK7-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
363 // CK7-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double*
364 // CK7-64-64-DAG: store double {{.+}}, double* [[CADDR]],
365
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000366 // CK7-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**
367 // CK7-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
368 // CK7-32-DAG: store double* [[DECL:%[^,]+]], double** [[CBP1]]
369 // CK7-32-DAG: store double* [[DECL]], double** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000370
371 // CK7-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
372 // CK7-32: call void [[KERNEL:@.+]](double* [[DECL]])
373 #pragma omp target
374 {
375 d += 1.0;
376 }
377}
378
379// CK7-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
380// CK7-64: [[ADDR:%.+]] = alloca i[[sz]],
381// CK7-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
382// CK7-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double*
383// CK7-64: {{.+}} = load double, double* [[CADDR]],
384
385// CK7-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]])
386// CK7-32: [[ADDR:%.+]] = alloca double*,
387// CK7-32: store double* [[ARG]], double** [[ADDR]],
388// CK7-32: [[REF:%.+]] = load double*, double** [[ADDR]],
389// CK7-32: {{.+}} = load double, double* [[REF]],
390
391#endif
392///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000393// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK8
394// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
395// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK8
396// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK8
397// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
398// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK8
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000399#ifdef CK8
400
401// CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000402// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
403// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000404
405// CK8-LABEL: implicit_maps_float
406void implicit_maps_float (int a){
407 float f = (float)a;
408
409 // CK8-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
410 // CK8-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
411 // CK8-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
412 // CK8-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
413 // CK8-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000414 // CK8-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
415 // CK8-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
416 // CK8-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
417 // CK8-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000418 // CK8-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
419 // CK8-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
420 // CK8-DAG: store float {{.+}}, float* [[CADDR]],
421
422 // CK8: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
423 #pragma omp target
424 {
425 f += 1.0;
426 }
427}
428
429// CK8: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
430// CK8: [[ADDR:%.+]] = alloca i[[sz]],
431// CK8: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
432// CK8: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
433// CK8: {{.+}} = load float, float* [[CADDR]],
434
435#endif
436///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000437// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK9
438// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
439// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK9
440// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK9
441// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
442// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK9
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000443#ifdef CK9
444
445// CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Samuel Antao6782e942016-05-26 16:48:10 +0000446// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
447// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 35]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000448
449// CK9-LABEL: implicit_maps_array
450void implicit_maps_array (int a){
451 double darr[2] = {(double)a, (double)a};
452
453 // CK9-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
454 // CK9-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
455 // CK9-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
456 // CK9-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
457 // CK9-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000458 // CK9-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]**
459 // CK9-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]**
460 // CK9-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]]
461 // CK9-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000462
463 // CK9: call void [[KERNEL:@.+]]([2 x double]* [[DECL]])
464 #pragma omp target
465 {
466 darr[0] += 1.0;
467 darr[1] += 1.0;
468 }
469}
470
471// CK9: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]])
472// CK9: [[ADDR:%.+]] = alloca [2 x double]*,
473// CK9: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]],
474// CK9: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]],
475// CK9: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i[[sz]] 0, i[[sz]] 0
476#endif
477///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000478// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK10
479// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
480// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK10
481// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK10
482// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
483// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK10
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000484#ifdef CK10
485
Samuel Antao6782e942016-05-26 16:48:10 +0000486// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] zeroinitializer
487// Map types: OMP_MAP_IS_FIRST = 32
488// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 32]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000489
490// CK10-LABEL: implicit_maps_pointer
491void implicit_maps_pointer (){
492 double *ddyn;
493
494 // CK10-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
495 // CK10-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
496 // CK10-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
497 // CK10-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
498 // CK10-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000499 // CK10-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double**
500 // CK10-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double**
501 // CK10-DAG: store double* [[PTR:%[^,]+]], double** [[CBP1]]
502 // CK10-DAG: store double* [[PTR]], double** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000503
504 // CK10: call void [[KERNEL:@.+]](double* [[PTR]])
505 #pragma omp target
506 {
507 ddyn[0] += 1.0;
508 ddyn[1] += 1.0;
509 }
510}
511
512// CK10: define internal void [[KERNEL]](double* {{.*}}[[ARG:%.+]])
513// CK10: [[ADDR:%.+]] = alloca double*,
514// CK10: store double* [[ARG]], double** [[ADDR]],
515// CK10: [[REF:%.+]] = load double*, double** [[ADDR]],
516// CK10: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] 0
517
518#endif
519///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000520// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK11
521// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
522// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK11
523// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK11
524// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
525// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK11
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000526#ifdef CK11
527
528// CK11-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Samuel Antao6782e942016-05-26 16:48:10 +0000529// Map types: OMP_MAP_TO + OMP_MAP_IS_FIRST = 33
530// CK11-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000531
532// CK11-LABEL: implicit_maps_double_complex
533void implicit_maps_double_complex (int a){
534 double _Complex dc = (double)a;
535
536 // CK11-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
537 // CK11-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
538 // CK11-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
539 // CK11-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
540 // CK11-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000541 // CK11-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { double, double }**
542 // CK11-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { double, double }**
543 // CK11-DAG: store { double, double }* [[PTR:%[^,]+]], { double, double }** [[CBP1]]
544 // CK11-DAG: store { double, double }* [[PTR]], { double, double }** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000545
546 // CK11: call void [[KERNEL:@.+]]({ double, double }* [[PTR]])
547 #pragma omp target
548 {
549 dc *= dc;
550 }
551}
552
553// CK11: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]])
554// CK11: [[ADDR:%.+]] = alloca { double, double }*,
555// CK11: store { double, double }* [[ARG]], { double, double }** [[ADDR]],
556// CK11: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]],
557// CK11: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0
558#endif
559///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000560// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-64
561// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
562// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-64
563// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-32
564// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
565// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000566#ifdef CK12
567
568// For a 32-bit targets, the value doesn't fit the size of the pointer,
569// therefore it is passed by reference with a map 'to' specification.
570
571// CK12-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000572// Map types: OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
573// CK12-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
574// Map types: OMP_MAP_TO + OMP_MAP_IS_FIRST = 33
575// CK12-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000576
577// CK12-LABEL: implicit_maps_float_complex
578void implicit_maps_float_complex (int a){
579 float _Complex fc = (float)a;
580
581 // CK12-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
582 // CK12-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
583 // CK12-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
584 // CK12-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
585 // CK12-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
586
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000587 // CK12-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
588 // CK12-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
589 // CK12-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]]
590 // CK12-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000591 // CK12-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
592 // CK12-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
593 // CK12-64-DAG: store { float, float } {{.+}}, { float, float }* [[CADDR]],
594
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000595 // CK12-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { float, float }**
596 // CK12-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { float, float }**
597 // CK12-32-DAG: store { float, float }* [[DECL:%[^,]+]], { float, float }** [[CBP1]]
598 // CK12-32-DAG: store { float, float }* [[DECL]], { float, float }** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000599
600 // CK12-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
601 // CK12-32: call void [[KERNEL:@.+]]({ float, float }* [[DECL]])
602 #pragma omp target
603 {
604 fc *= fc;
605 }
606}
607
608// CK12-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
609// CK12-64: [[ADDR:%.+]] = alloca i[[sz]],
610// CK12-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
611// CK12-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
612// CK12-64: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[CADDR]], i32 0, i32 0
613
614// CK12-32: define internal void [[KERNEL]]({ float, float }* {{.+}}[[ARG:%.+]])
615// CK12-32: [[ADDR:%.+]] = alloca { float, float }*,
616// CK12-32: store { float, float }* [[ARG]], { float, float }** [[ADDR]],
617// CK12-32: [[REF:%.+]] = load { float, float }*, { float, float }** [[ADDR]],
618// CK12-32: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[REF]], i32 0, i32 0
619#endif
620///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000621// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK13
622// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
623// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK13
624// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK13
625// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
626// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK13
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000627#ifdef CK13
628
629// We don't have a constant map size for VLAs.
630// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000631// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
632// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
633// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
634// CK13-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000635
636// CK13-LABEL: implicit_maps_variable_length_array
637void implicit_maps_variable_length_array (int a){
638 double vla[2][a];
639
640 // CK13-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i[[sz:64|32]]* [[SGEP:%[^,]+]], {{.+}}[[TYPES]]{{.+}})
641 // CK13-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
642 // CK13-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
643 // CK13-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SS:%[^,]+]], i32 0, i32 0
644
645 // CK13-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
646 // CK13-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
647 // CK13-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000648 // CK13-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[sz]]*
649 // CK13-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[sz]]*
650 // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CBP0]]
651 // CK13-DAG: store i[[sz]] 2, i[[sz]]* [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000652 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S0]],
653
654 // CK13-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
655 // CK13-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
656 // CK13-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000657 // CK13-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
658 // CK13-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
659 // CK13-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
660 // CK13-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000661 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S1]],
662
663 // CK13-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
664 // CK13-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
665 // CK13-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000666 // CK13-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double**
667 // CK13-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
668 // CK13-DAG: store double* [[DECL:%.+]], double** [[CBP2]]
669 // CK13-DAG: store double* [[DECL]], double** [[CP2]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000670 // CK13-DAG: store i[[sz]] [[VALS2:%.+]], i[[sz]]* [[S2]],
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000671 // CK13-DAG: [[VALS2]] = mul nuw i[[sz]] %{{.+}}, 8
672
673 // CK13: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]])
674 #pragma omp target
675 {
676 vla[1][3] += 1.0;
677 }
678}
679
Alexey Bataev2f5ed342016-10-13 09:52:46 +0000680// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]])
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000681// CK13: [[ADDR0:%.+]] = alloca i[[sz]],
682// CK13: [[ADDR1:%.+]] = alloca i[[sz]],
683// CK13: [[ADDR2:%.+]] = alloca double*,
684// CK13: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]],
685// CK13: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]],
686// CK13: store double* [[ARG]], double** [[ADDR2]],
687// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR0]],
688// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR1]],
689// CK13: [[REF:%.+]] = load double*, double** [[ADDR2]],
690// CK13: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}}
691#endif
692///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000693// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-64
694// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
695// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-64
696// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-32
697// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
698// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000699#ifdef CK14
700
701// CK14-DAG: [[ST:%.+]] = type { i32, double }
702// CK14-DAG: [[SIZES:@.+]] = {{.+}}constant [2 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}, i{{64|32}} 4]
703// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000704// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
705// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
706// CK14-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000707
708class SSS {
709public:
710 int a;
711 double b;
712
713 void foo(int c) {
714 #pragma omp target
715 {
716 a += c;
717 b += (double)c;
718 }
719 }
720
721 SSS(int a, double b) : a(a), b(b) {}
722};
723
724// CK14-LABEL: implicit_maps_class
725void implicit_maps_class (int a){
726 SSS sss(a, (double)a);
727
728 // CK14: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
729 // CK14-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
730 // CK14-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
731 // CK14-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
732
733 // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
734 // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000735 // CK14-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
736 // CK14-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
737 // CK14-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
738 // CK14-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000739
740 // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
741 // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000742 // CK14-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
743 // CK14-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
744 // CK14-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
745 // CK14-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000746 // CK14-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
747 // CK14-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
748 // CK14-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
749
750 // CK14: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
751 sss.foo(123);
752}
753
754// CK14: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
755// CK14: [[ADDR0:%.+]] = alloca [[ST]]*,
756// CK14: [[ADDR1:%.+]] = alloca i[[sz]],
757// CK14: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
758// CK14: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
759// CK14: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
760// CK14-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
761// CK14-64: {{.+}} = load i32, i32* [[CADDR1]],
762// CK14-32: {{.+}} = load i32, i32* [[ADDR1]],
763// CK14: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
764
765#endif
766///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000767// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-64
768// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
769// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-64
770// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-32
771// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
772// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000773#ifdef CK15
774
775// CK15: [[ST:%.+]] = type { i32, double, i32* }
776// CK15: [[SIZES:@.+]] = {{.+}}constant [2 x i[[sz:64|32]]] [i{{64|32}} {{24|16}}, i{{64|32}} 4]
777// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000778// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
779// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
780// CK15: [[TYPES:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000781
782// CK15: [[SIZES2:@.+]] = {{.+}}constant [2 x i[[sz]]] [i{{64|32}} {{24|16}}, i{{64|32}} 4]
783// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000784// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
785// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
786// CK15: [[TYPES2:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000787
788template<int x>
789class SSST {
790public:
791 int a;
792 double b;
793 int &r;
794
795 void foo(int c) {
796 #pragma omp target
797 {
798 a += c + x;
799 b += (double)(c + x);
800 r += x;
801 }
802 }
803 template<int y>
804 void bar(int c) {
805 #pragma omp target
806 {
807 a += c + x + y;
808 b += (double)(c + x + y);
809 r += x + y;
810 }
811 }
812
813 SSST(int a, double b, int &r) : a(a), b(b), r(r) {}
814};
815
816// CK15-LABEL: implicit_maps_templated_class
817void implicit_maps_templated_class (int a){
818 SSST<123> ssst(a, (double)a, a);
819
820 // CK15: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
821 // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
822 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
823 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
824
825 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
826 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000827 // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
828 // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
829 // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
830 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000831
832 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
833 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000834 // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
835 // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
836 // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
837 // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000838 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
839 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
840 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
841
842 // CK15: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
843 ssst.foo(456);
844
845 // CK15: define {{.*}}void @{{.+}}bar{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
846 // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
847 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
848 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
849
850 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
851 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000852 // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
853 // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
854 // CK15-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP0]]
855 // CK15-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP0]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000856
857 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
858 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000859 // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
860 // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
861 // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
862 // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000863 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
864 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
865 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
866
867 // CK15: call void [[KERNEL2:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
868 ssst.bar<210>(789);
869}
870
871// CK15: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
872// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
873// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
874// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
875// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
876// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
877// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
878// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
879// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
880// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
881
882// CK15: define internal void [[KERNEL2]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
883// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
884// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
885// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
886// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
887// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
888// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
889// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
890// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
891// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
892
893#endif
894///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000895// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-64
896// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
897// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-64
898// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-32
899// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
900// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000901#ifdef CK16
902
903// CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
904// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000905// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
906// CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000907
908template<int y>
909int foo(int d) {
910 int res = d;
911 #pragma omp target
912 {
913 res += y;
914 }
915 return res;
916}
917// CK16-LABEL: implicit_maps_templated_function
918void implicit_maps_templated_function (int a){
919 int i = a;
920
921 // CK16: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
922 // CK16-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
923 // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
924 // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
925
926 // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
927 // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000928 // CK16-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
929 // CK16-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
930 // CK16-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
931 // CK16-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000932 // CK16-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
933 // CK16-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
934 // CK16-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
935
936 // CK16: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
937 i = foo<543>(i);
938}
939// CK16: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
940// CK16: [[ADDR:%.+]] = alloca i[[sz]],
941// CK16: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
942// CK16-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
943// CK16-64: {{.+}} = load i32, i32* [[CADDR]],
944// CK16-32: {{.+}} = load i32, i32* [[ADDR]],
945
946#endif
947///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000948// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK17
949// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
950// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK17
951// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK17
952// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
953// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK17
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000954#ifdef CK17
955
956// CK17-DAG: [[ST:%.+]] = type { i32, double }
957// CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}]
Samuel Antao6782e942016-05-26 16:48:10 +0000958// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
959// CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 35]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000960
961class SSS {
962public:
963 int a;
964 double b;
965};
966
967// CK17-LABEL: implicit_maps_struct
968void implicit_maps_struct (int a){
969 SSS s = {a, (double)a};
970
971 // CK17-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
972 // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
973 // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
974 // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
975 // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +0000976 // CK17-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
977 // CK17-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]**
978 // CK17-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]]
979 // CK17-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000980
981 // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]])
982 #pragma omp target
983 {
984 s.a += 1;
985 s.b += 1.0;
986 }
987}
988
989// CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]])
990// CK17: [[ADDR:%.+]] = alloca [[ST]]*,
991// CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]],
992// CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]],
993// CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0
994#endif
995///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000996// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-64
997// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
998// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-64
999// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-32
1000// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1001// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001002#ifdef CK18
1003
1004// CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
1005// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +00001006// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
1007// CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001008
1009template<typename T>
1010int foo(T d) {
1011 #pragma omp target
1012 {
1013 d += (T)1;
1014 }
1015 return d;
1016}
1017// CK18-LABEL: implicit_maps_template_type_capture
1018void implicit_maps_template_type_capture (int a){
1019 int i = a;
1020
1021 // CK18: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
1022 // CK18-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
1023 // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1024 // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1025
1026 // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1027 // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001028 // CK18-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]*
1029 // CK18-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]*
1030 // CK18-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]]
1031 // CK18-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001032 // CK18-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1033 // CK18-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1034 // CK18-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1035
1036 // CK18: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1037 i = foo(i);
1038}
1039// CK18: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1040// CK18: [[ADDR:%.+]] = alloca i[[sz]],
1041// CK18: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1042// CK18-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1043// CK18-64: {{.+}} = load i32, i32* [[CADDR]],
1044// CK18-32: {{.+}} = load i32, i32* [[ADDR]],
1045
1046#endif
Samuel Antao86ace552016-04-27 22:40:57 +00001047///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00001048// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-64
1049// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1050// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-64
1051// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-32
1052// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1053// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-32
Samuel Antao86ace552016-04-27 22:40:57 +00001054#ifdef CK19
1055
1056// CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001057// CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001058
1059// CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00001060// CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001061
1062// CK19: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001063// CK19: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001064
1065// CK19: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001066// CK19: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001067
1068// CK19: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00001069// CK19: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001070
1071// CK19: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001072// CK19: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001073
Samuel Antao6782e942016-05-26 16:48:10 +00001074// CK19: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001075
Samuel Antao6782e942016-05-26 16:48:10 +00001076// CK19: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001077
1078// CK19: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001079// CK19: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001080
1081// CK19: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00001082// CK19: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001083
1084// CK19: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001085// CK19: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001086
1087// CK19: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001088// CK19: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001089
1090// CK19: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001091// CK19: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001092
Samuel Antao6782e942016-05-26 16:48:10 +00001093// CK19: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001094
Samuel Antao6782e942016-05-26 16:48:10 +00001095// CK19: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001096
1097// CK19: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001098// CK19: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001099
Samuel Antao6782e942016-05-26 16:48:10 +00001100// CK19: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001101
1102// CK19: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001103// CK19: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001104
1105// CK19: [[SIZE18:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001106// CK19: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001107
Samuel Antao6782e942016-05-26 16:48:10 +00001108// CK19: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001109
1110// CK19: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001111// CK19: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001112
Samuel Antao6782e942016-05-26 16:48:10 +00001113// CK19: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001114
1115// CK19: [[SIZE22:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001116// CK19: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001117
1118// CK19: [[SIZE23:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001119// CK19: [[MTYPE23:@.+]] = private {{.*}}constant [1 x i32] [i32 39]
Samuel Antao86ace552016-04-27 22:40:57 +00001120
1121// CK19: [[SIZE24:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 480]
Samuel Antao6782e942016-05-26 16:48:10 +00001122// CK19: [[MTYPE24:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001123
1124// CK19: [[SIZE25:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00001125// CK19: [[MTYPE25:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001126
1127// CK19: [[SIZE26:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 24]
Samuel Antao6782e942016-05-26 16:48:10 +00001128// CK19: [[MTYPE26:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001129
1130// CK19: [[SIZE27:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001131// CK19: [[MTYPE27:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001132
1133// CK19: [[SIZE28:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00001134// CK19: [[MTYPE28:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001135
1136// CK19: [[SIZE29:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001137// CK19: [[MTYPE29:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001138
Samuel Antao6782e942016-05-26 16:48:10 +00001139// CK19: [[MTYPE30:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001140
1141// CK19: [[SIZE31:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 40]
Samuel Antao6782e942016-05-26 16:48:10 +00001142// CK19: [[MTYPE31:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001143
1144// CK19: [[SIZE32:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001145// CK19: [[MTYPE32:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001146
1147// CK19: [[SIZE33:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001148// CK19: [[MTYPE33:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001149
1150// CK19: [[SIZE34:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001151// CK19: [[MTYPE34:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001152
Samuel Antao6782e942016-05-26 16:48:10 +00001153// CK19: [[MTYPE35:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001154
1155// CK19: [[SIZE36:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 208]
Samuel Antao6782e942016-05-26 16:48:10 +00001156// CK19: [[MTYPE36:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001157
Samuel Antao6782e942016-05-26 16:48:10 +00001158// CK19: [[MTYPE37:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001159
Samuel Antao6782e942016-05-26 16:48:10 +00001160// CK19: [[MTYPE38:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001161
Samuel Antao6782e942016-05-26 16:48:10 +00001162// CK19: [[MTYPE39:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001163
Samuel Antao6782e942016-05-26 16:48:10 +00001164// CK19: [[MTYPE40:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001165
1166// CK19: [[SIZE41:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 208]
Samuel Antao6782e942016-05-26 16:48:10 +00001167// CK19: [[MTYPE41:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001168
1169// CK19: [[SIZE42:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 104]
Samuel Antao6782e942016-05-26 16:48:10 +00001170// CK19: [[MTYPE42:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001171
Samuel Antao6782e942016-05-26 16:48:10 +00001172// CK19: [[MTYPE43:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001173
1174// CK19-LABEL: explicit_maps_single
1175void explicit_maps_single (int ii){
1176 // Map of a scalar.
1177 int a = ii;
1178
1179 // Region 00
1180 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
1181 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1182 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1183
1184 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1185 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001186 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1187 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1188 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1189 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001190
1191 // CK19: call void [[CALL00:@.+]](i32* {{[^,]+}})
1192 #pragma omp target map(alloc:a)
1193 {
1194 ++a;
1195 }
1196
1197 // Map of an array.
1198 int arra[100];
1199
1200 // Region 01
1201 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
1202 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1203 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1204
1205 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1206 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001207 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1208 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]**
1209 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1210 // CK19-DAG: store [100 x i32]* [[VAR0]], [100 x i32]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001211
1212 // CK19: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
1213 #pragma omp target map(to:arra)
1214 {
1215 arra[50]++;
1216 }
1217
1218 // Region 02
1219 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
1220 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1221 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1222
1223 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1224 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001225 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1226 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1227 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1228 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001229 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20
1230
1231 // CK19: call void [[CALL02:@.+]]([100 x i32]* {{[^,]+}})
1232 #pragma omp target map(from:arra[20:60])
1233 {
1234 arra[50]++;
1235 }
1236
1237 // Region 03
1238 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
1239 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1240 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1241
1242 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1243 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001244 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1245 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1246 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1247 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001248 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1249
1250 // CK19: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
1251 #pragma omp target map(tofrom:arra[:60])
1252 {
1253 arra[50]++;
1254 }
1255
1256 // Region 04
1257 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
1258 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1259 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1260
1261 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1262 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001263 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1264 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1265 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1266 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001267 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1268
1269 // CK19: call void [[CALL04:@.+]]([100 x i32]* {{[^,]+}})
1270 #pragma omp target map(alloc:arra[:])
1271 {
1272 arra[50]++;
1273 }
1274
1275 // Region 05
1276 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
1277 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1278 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1279
1280 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1281 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001282 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1283 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1284 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1285 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001286 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 15
1287
1288 // CK19: call void [[CALL05:@.+]]([100 x i32]* {{[^,]+}})
1289 #pragma omp target map(to:arra[15])
1290 {
1291 arra[15]++;
1292 }
1293
1294 // Region 06
1295 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
1296 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1297 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1298 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1299
1300 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1301 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1302 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001303 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1304 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1305 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1306 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001307 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001308 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1309 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1310
1311 // CK19: call void [[CALL06:@.+]]([100 x i32]* {{[^,]+}})
1312 #pragma omp target map(tofrom:arra[ii:ii+23])
1313 {
1314 arra[50]++;
1315 }
1316
1317 // Region 07
1318 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
1319 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1320 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1321 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1322
1323 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1324 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1325 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001326 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1327 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1328 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1329 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001330 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001331 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1332 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1333
1334 // CK19: call void [[CALL07:@.+]]([100 x i32]* {{[^,]+}})
1335 #pragma omp target map(alloc:arra[:ii])
1336 {
1337 arra[50]++;
1338 }
1339
1340 // Region 08
1341 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
1342 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1343 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1344
1345 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1346 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001347 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
1348 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1349 // CK19-DAG: store [100 x i32]* [[VAR0:%.+]], [100 x i32]** [[CBP0]]
1350 // CK19-DAG: store i32* [[SEC0:%[^,]+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001351 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1352
1353 // CK19: call void [[CALL08:@.+]]([100 x i32]* {{[^,]+}})
1354 #pragma omp target map(tofrom:arra[ii])
1355 {
1356 arra[15]++;
1357 }
1358
1359 // Map of a pointer.
1360 int *pa;
1361
1362 // Region 09
1363 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
1364 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1365 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1366
1367 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1368 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001369 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
1370 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
1371 // CK19-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]]
1372 // CK19-DAG: store i32** [[VAR0]], i32*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001373
1374 // CK19: call void [[CALL09:@.+]](i32** {{[^,]+}})
1375 #pragma omp target map(from:pa)
1376 {
1377 pa[50]++;
1378 }
1379
1380 // Region 10
1381 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
1382 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1383 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1384
1385 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1386 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001387 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1388 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1389 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1390 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001391 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1392 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 20
1393 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1394
1395 // CK19: call void [[CALL10:@.+]](i32* {{[^,]+}})
1396 #pragma omp target map(tofrom:pa[20:60])
1397 {
1398 pa[50]++;
1399 }
1400
1401 // Region 11
1402 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
1403 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1404 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1405
1406 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1407 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001408 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1409 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1410 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1411 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001412 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1413 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1414 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1415
1416 // CK19: call void [[CALL11:@.+]](i32* {{[^,]+}})
1417 #pragma omp target map(alloc:pa[:60])
1418 {
1419 pa[50]++;
1420 }
1421
1422 // Region 12
1423 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
1424 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1425 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1426
1427 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1428 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001429 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1430 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1431 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1432 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001433 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1434 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 15
1435 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1436
1437 // CK19: call void [[CALL12:@.+]](i32* {{[^,]+}})
1438 #pragma omp target map(to:pa[15])
1439 {
1440 pa[15]++;
1441 }
1442
1443 // Region 13
1444 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
1445 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1446 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1447 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1448
1449 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1450 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1451 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001452 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1453 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1454 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1455 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001456 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001457 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1458 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1459 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1460 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1461
1462 // CK19: call void [[CALL13:@.+]](i32* {{[^,]+}})
1463 #pragma omp target map(alloc:pa[ii-23:ii])
1464 {
1465 pa[50]++;
1466 }
1467
1468 // Region 14
1469 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
1470 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1471 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1472 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1473
1474 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1475 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1476 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001477 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1478 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1479 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1480 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001481 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001482 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1483 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1484 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1485 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1486
1487 // CK19: call void [[CALL14:@.+]](i32* {{[^,]+}})
1488 #pragma omp target map(to:pa[:ii])
1489 {
1490 pa[50]++;
1491 }
1492
1493 // Region 15
1494 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
1495 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1496 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1497
1498 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1499 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001500 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1501 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1502 // CK19-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
1503 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001504 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1505 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1506 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1507
1508 // CK19: call void [[CALL15:@.+]](i32* {{[^,]+}})
1509 #pragma omp target map(from:pa[ii+12])
1510 {
1511 pa[15]++;
1512 }
1513
1514 // Map of a variable-size array.
1515 int va[ii];
1516
1517 // Region 16
1518 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE16]]{{.+}})
1519 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1520 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1521 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1522
1523 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1524 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1525 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001526 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1527 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1528 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1529 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001530 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001531
1532 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1533 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1534 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001535 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1536 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1537 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1538 // CK19-DAG: store i32* [[VAR1]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001539 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001540 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1541
1542 // CK19: call void [[CALL16:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1543 #pragma omp target map(to:va)
1544 {
1545 va[50]++;
1546 }
1547
1548 // Region 17
1549 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
1550 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1551 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1552
1553 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1554 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001555 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1556 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1557 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1558 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001559
1560 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1561 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001562 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1563 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1564 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1565 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001566 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 20
1567
1568 // CK19: call void [[CALL17:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1569 #pragma omp target map(from:va[20:60])
1570 {
1571 va[50]++;
1572 }
1573
1574 // Region 18
1575 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE18]]{{.+}})
1576 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1577 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1578
1579 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1580 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001581 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1582 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1583 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1584 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001585
1586 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1587 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001588 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1589 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1590 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1591 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001592 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1593
1594 // CK19: call void [[CALL18:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1595 #pragma omp target map(tofrom:va[:60])
1596 {
1597 va[50]++;
1598 }
1599
1600 // Region 19
1601 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
1602 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1603 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1604 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1605
1606 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1607 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1608 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001609 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1610 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1611 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1612 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001613 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001614
1615 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1616 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1617 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001618 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1619 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1620 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1621 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001622 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001623 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1624 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1625
1626 // CK19: call void [[CALL19:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1627 #pragma omp target map(alloc:va[:])
1628 {
1629 va[50]++;
1630 }
1631
1632 // Region 20
1633 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
1634 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1635 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1636
1637 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1638 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001639 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1640 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1641 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1642 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001643
1644 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1645 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001646 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1647 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1648 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1649 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001650 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 15
1651
1652 // CK19: call void [[CALL20:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1653 #pragma omp target map(to:va[15])
1654 {
1655 va[15]++;
1656 }
1657
1658 // Region 21
1659 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
1660 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1661 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1662 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1663
1664 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1665 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1666 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001667 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1668 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1669 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1670 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001671 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001672
1673 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1674 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1675 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001676 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1677 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1678 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1679 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001680 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001681 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1682 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1683
1684 // CK19: call void [[CALL21:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1685 #pragma omp target map(tofrom:va[ii:ii+23])
1686 {
1687 va[50]++;
1688 }
1689
1690 // Region 22
1691 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE22]]{{.+}})
1692 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1693 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1694
1695 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1696 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001697 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1698 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1699 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CBP0]]
1700 // CK19-DAG: store i[[Z]] {{%.+}}, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001701
1702 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1703 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001704 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
1705 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
1706 // CK19-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
1707 // CK19-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001708 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1709
1710 // CK19: call void [[CALL22:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1711 #pragma omp target map(tofrom:va[ii])
1712 {
1713 va[15]++;
1714 }
1715
1716 // Always.
1717 // Region 23
1718 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE23]]{{.+}})
1719 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1720 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1721
1722 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1723 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001724 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
1725 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1726 // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
1727 // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001728
1729 // CK19: call void [[CALL23:@.+]](i32* {{[^,]+}})
1730 #pragma omp target map(always, tofrom: a)
1731 {
1732 a++;
1733 }
1734
1735 // Multidimensional arrays.
1736 int marr[4][5][6];
1737 int ***mptr;
1738
1739 // Region 24
1740 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE24]]{{.+}})
1741 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1742 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1743
1744 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1745 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001746 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
1747 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [4 x [5 x [6 x i32]]]**
1748 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
1749 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0]], [4 x [5 x [6 x i32]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001750
1751 // CK19: call void [[CALL24:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1752 #pragma omp target map(tofrom: marr)
1753 {
1754 marr[1][2][3]++;
1755 }
1756
1757 // Region 25
1758 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE25]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE25]]{{.+}})
1759 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1760 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1761
1762 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1763 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001764 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
1765 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1766 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
1767 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001768 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 2
1769 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1770 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1771
1772 // CK19: call void [[CALL25:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1773 #pragma omp target map(tofrom: marr[1][2][2:4])
1774 {
1775 marr[1][2][3]++;
1776 }
1777
1778 // Region 26
1779 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE26]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE26]]{{.+}})
1780 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1781 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1782
1783 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1784 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001785 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
1786 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1787 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
1788 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001789 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 0
1790 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1791 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1792
1793 // CK19: call void [[CALL26:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1794 #pragma omp target map(tofrom: marr[1][2][:])
1795 {
1796 marr[1][2][3]++;
1797 }
1798
1799 // Region 27
1800 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE27]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE27]]{{.+}})
1801 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1802 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1803
1804 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1805 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001806 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [4 x [5 x [6 x i32]]]**
1807 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
1808 // CK19-DAG: store [4 x [5 x [6 x i32]]]* [[VAR0:%.+]], [4 x [5 x [6 x i32]]]** [[CBP0]]
1809 // CK19-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001810 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 3
1811 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1812 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1813
1814 // CK19: call void [[CALL27:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1815 #pragma omp target map(tofrom: marr[1][2][3])
1816 {
1817 marr[1][2][3]++;
1818 }
1819
1820 // Region 28
1821 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE28]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE28]]{{.+}})
1822 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1823 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1824
1825 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1826 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001827 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32****
1828 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32****
1829 // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]]
1830 // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001831 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1832 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1833 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1834
1835 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1836 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001837 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32****
1838 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32***
1839 // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]]
1840 // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001841 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1842 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1843 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1844 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1845
1846 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1847 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001848 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32***
1849 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
1850 // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]]
1851 // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00001852 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 2
1853 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1854 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1855 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1856 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1857 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1858
1859 // CK19: call void [[CALL28:@.+]](i32*** {{[^,]+}})
1860 #pragma omp target map(tofrom: mptr[1][2][2:4])
1861 {
1862 mptr[1][2][3]++;
1863 }
1864
1865 // Region 29
1866 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE29]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE29]]{{.+}})
1867 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1868 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1869
1870 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1871 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001872 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32****
1873 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32****
1874 // CK19-DAG: store i32*** [[VAR0:%.+]], i32**** [[CBP0]]
1875 // CK19-DAG: store i32*** [[SEC0:%.+]], i32**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001876 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1877 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1878 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1879
1880 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1881 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001882 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32****
1883 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32***
1884 // CK19-DAG: store i32*** [[SEC0]], i32**** [[CBP1]]
1885 // CK19-DAG: store i32** [[SEC1:%.+]], i32*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001886 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1887 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1888 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1889 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1890
1891 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1892 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001893 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i32***
1894 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i32**
1895 // CK19-DAG: store i32** [[SEC1]], i32*** [[CBP2]]
1896 // CK19-DAG: store i32* [[SEC2:%.+]], i32** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00001897 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 3
1898 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1899 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1900 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1901 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1902 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1903
1904 // CK19: call void [[CALL29:@.+]](i32*** {{[^,]+}})
1905 #pragma omp target map(tofrom: mptr[1][2][3])
1906 {
1907 mptr[1][2][3]++;
1908 }
1909
1910 // Multidimensional VLA.
1911 double mva[23][ii][ii+5];
1912
1913 // Region 30
1914 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE30]]{{.+}})
1915 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1916 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1917 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1918 //
1919 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1920 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1921 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001922 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1923 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1924 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]]
1925 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001926 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
1927 //
1928 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1929 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1930 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001931 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
1932 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
1933 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
1934 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001935 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001936 // CK19-64-DAG: [[VAR1]] = zext i32 %{{[^,]+}} to i64
1937 // CK19-64-DAG: [[VAR11]] = zext i32 %{{[^,]+}} to i64
1938 //
1939 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1940 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1941 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001942 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]*
1943 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]*
1944 // CK19-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]]
1945 // CK19-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00001946 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00001947 // CK19-64-DAG: [[VAR2]] = zext i32 %{{[^,]+}} to i64
1948 // CK19-64-DAG: [[VAR22]] = zext i32 %{{[^,]+}} to i64
1949 //
1950 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1951 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
1952 // CK19-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001953 // CK19-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double**
1954 // CK19-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
1955 // CK19-DAG: store double* [[VAR3:%.+]], double** [[CBP3]]
1956 // CK19-DAG: store double* [[VAR3]], double** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00001957 // CK19-DAG: store i[[Z]] [[CSVAL3:%[^,]+]], i[[Z]]* [[S3]]
Samuel Antao86ace552016-04-27 22:40:57 +00001958 // CK19-DAG: [[CSVAL3]] = mul nuw i[[Z]] %{{[^,]+}}, {{8|4}}
1959
1960 // CK19: call void [[CALL30:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
1961 #pragma omp target map(tofrom: mva)
1962 {
1963 mva[1][2][3]++;
1964 }
1965
1966 // Region 31
1967 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE31]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE31]]{{.+}})
1968 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1969 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1970 //
1971 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1972 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001973 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
1974 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
1975 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CBP0]]
1976 // CK19-DAG: store i[[Z]] 23, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00001977 //
1978 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1979 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001980 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
1981 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
1982 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
1983 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00001984 //
1985 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1986 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001987 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to i[[Z]]*
1988 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to i[[Z]]*
1989 // CK19-DAG: store i[[Z]] [[VAR2:%.+]], i[[Z]]* [[CBP2]]
1990 // CK19-DAG: store i[[Z]] [[VAR22:%.+]], i[[Z]]* [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00001991 //
1992 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1993 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00001994 // CK19-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double**
1995 // CK19-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
1996 // CK19-DAG: store double* [[VAR3:%.+]], double** [[CBP3]]
1997 // CK19-DAG: store double* [[SEC3:%.+]], double** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00001998 // CK19-DAG: [[SEC3]] = getelementptr {{.*}}double* [[SEC33:%.+]], i[[Z]] 0
1999 // CK19-DAG: [[SEC33]] = getelementptr {{.*}}double* [[SEC333:%.+]], i[[Z]] [[IDX3:%.+]]
2000 // CK19-DAG: [[IDX3]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}}
2001 // CK19-DAG: [[SEC333]] = getelementptr {{.*}}double* [[VAR3]], i[[Z]] [[IDX33:%.+]]
2002 // CK19-DAG: [[IDX33]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2003
2004 // CK19: call void [[CALL31:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
2005 #pragma omp target map(tofrom: mva[1][ii-2][:5])
2006 {
2007 mva[1][2][3]++;
2008 }
2009
2010 // Multidimensional array sections.
2011 double marras[11][12][13];
2012 double mvlaas[11][ii][13];
2013 double ***mptras;
2014
2015 // Region 32
2016 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE32]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE32]]{{.+}})
2017 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2018 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2019
2020 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2021 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002022 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2023 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [11 x [12 x [13 x double]]]**
2024 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2025 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0]], [11 x [12 x [13 x double]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002026
2027 // CK19: call void [[CALL32:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2028 #pragma omp target map(marras)
2029 {
2030 marras[1][2][3]++;
2031 }
2032
2033 // Region 33
2034 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE33]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE33]]{{.+}})
2035 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2036 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2037
2038 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2039 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002040 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2041 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]**
2042 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2043 // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002044 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2045
2046 // CK19: call void [[CALL33:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2047 #pragma omp target map(marras[:])
2048 {
2049 marras[1][2][3]++;
2050 }
2051
2052 // Region 34
2053 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE34]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE34]]{{.+}})
2054 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2055 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2056
2057 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2058 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002059 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2060 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [12 x [13 x double]]**
2061 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2062 // CK19-DAG: store [12 x [13 x double]]* [[SEC0:%.+]], [12 x [13 x double]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002063 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2064
2065 // CK19: call void [[CALL34:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2066 #pragma omp target map(marras[:][:][:])
2067 {
2068 marras[1][2][3]++;
2069 }
2070
2071 // Region 35
2072 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE35]]{{.+}})
2073 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2074 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2075 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2076 //
2077 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2078 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2079 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2080
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002081 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2082 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2083 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2084 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002085 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002086 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2087 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2088 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2089
2090 // CK19: call void [[CALL35:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2091 #pragma omp target map(marras[1][:ii][:])
2092 {
2093 marras[1][2][3]++;
2094 }
2095
2096 // Region 36
2097 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE36]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE36]]{{.+}})
2098 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2099 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2100
2101 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2102 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002103 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2104 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2105 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2106 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002107 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i{{.+}} 0
2108 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 0
2109 // CK19-DAG: [[SEC000]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2110
2111 // CK19: call void [[CALL36:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2112 #pragma omp target map(marras[:1][:2][:13])
2113 {
2114 marras[1][2][3]++;
2115 }
2116
2117 // Region 37
2118 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE37]]{{.+}})
2119 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2120 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2121 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2122 //
2123 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2124 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2125 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002126 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2127 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2128 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2129 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002130 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2131 //
2132 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2133 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2134 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002135 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2136 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2137 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2138 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002139 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002140 //
2141 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2142 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2143 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002144 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2145 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2146 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2147 // CK19-DAG: store [13 x double]* [[VAR2]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002148 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002149 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2150
2151 // CK19: call void [[CALL37:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2152 #pragma omp target map(mvlaas)
2153 {
2154 mvlaas[1][2][3]++;
2155 }
2156
2157 // Region 38
2158 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE38]]{{.+}})
2159 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2160 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2161 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2162 //
2163 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2164 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2165 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002166 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2167 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2168 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2169 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002170 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2171 //
2172 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2173 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2174 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002175 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2176 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2177 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2178 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002179 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002180 //
2181 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2182 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2183 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002184 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2185 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2186 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2187 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002188 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002189 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2190 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2191 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2192
2193 // CK19: call void [[CALL38:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2194 #pragma omp target map(mvlaas[:])
2195 {
2196 mvlaas[1][2][3]++;
2197 }
2198
2199 // Region 39
2200 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE39]]{{.+}})
2201 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2202 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2203 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2204 //
2205 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2206 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2207 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002208 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2209 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2210 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2211 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002212 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2213 //
2214 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2215 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2216 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002217 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2218 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2219 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2220 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002221 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002222 //
2223 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2224 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2225 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002226 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2227 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2228 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2229 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002230 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002231 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2232 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2233 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2234
2235 // CK19: call void [[CALL39:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2236 #pragma omp target map(mvlaas[:][:][:])
2237 {
2238 mvlaas[1][2][3]++;
2239 }
2240
2241 // Region 40
2242 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE40]]{{.+}})
2243 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2244 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2245 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2246 //
2247 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2248 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2249 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002250 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2251 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2252 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2253 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002254 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2255 //
2256 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2257 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2258 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002259 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2260 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2261 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2262 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002263 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002264 //
2265 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2266 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2267 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002268 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2269 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2270 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2271 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002272 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002273 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2274 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2275 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2276
2277 // CK19: call void [[CALL40:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2278 #pragma omp target map(mvlaas[1][:ii][:])
2279 {
2280 mvlaas[1][2][3]++;
2281 }
2282
2283 // Region 41
2284 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE41]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE41]]{{.+}})
2285 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2286 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2287 //
2288 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2289 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002290 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[Z]]*
2291 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[Z]]*
2292 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CBP0]]
2293 // CK19-DAG: store i[[Z]] 11, i[[Z]]* [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002294 //
2295 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2296 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002297 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
2298 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
2299 // CK19-DAG: store i[[Z]] [[VAR1:%.+]], i[[Z]]* [[CBP1]]
2300 // CK19-DAG: store i[[Z]] [[VAR11:%.+]], i[[Z]]* [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002301 //
2302 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2303 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002304 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [13 x double]**
2305 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [13 x double]**
2306 // CK19-DAG: store [13 x double]* [[VAR2:%.+]], [13 x double]** [[CBP2]]
2307 // CK19-DAG: store [13 x double]* [[SEC2:%.+]], [13 x double]** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002308 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2309 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2310 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2311
2312 // CK19: call void [[CALL41:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2313 #pragma omp target map(mvlaas[:1][:2][:13])
2314 {
2315 mvlaas[1][2][3]++;
2316 }
2317
2318 // Region 42
2319 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE42]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE42]]{{.+}})
2320 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2321 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2322
2323 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2324 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002325 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to double****
2326 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to double****
2327 // CK19-DAG: store double*** [[VAR0:%.+]], double**** [[CBP0]]
2328 // CK19-DAG: store double*** [[SEC0:%.+]], double**** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002329 // CK19-DAG: [[VAR0]] = load double***, double**** [[PTR:%[^,]+]],
2330 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}double*** [[SEC00:[^,]+]], i{{.+}} 0
2331 // CK19-DAG: [[SEC00]] = load double***, double**** [[PTR]],
2332
2333 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2334 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002335 // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double****
2336 // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double***
2337 // CK19-DAG: store double*** [[SEC0]], double**** [[CBP1]]
2338 // CK19-DAG: store double** [[SEC1:%.+]], double*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002339 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}double** [[SEC11:[^,]+]], i{{.+}} 2
2340 // CK19-DAG: [[SEC11]] = load double**, double*** [[SEC111:%[^,]+]],
2341 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}double*** [[SEC1111:[^,]+]], i{{.+}} 0
2342 // CK19-DAG: [[SEC1111]] = load double***, double**** [[PTR]],
2343
2344 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2345 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002346 // CK19-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double***
2347 // CK19-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double**
2348 // CK19-DAG: store double** [[SEC1]], double*** [[CBP2]]
2349 // CK19-DAG: store double* [[SEC2:%.+]], double** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00002350 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}double* [[SEC22:[^,]+]], i{{.+}} 0
2351 // CK19-DAG: [[SEC22]] = load double*, double** [[SEC222:%[^,]+]],
2352 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}double** [[SEC2222:[^,]+]], i{{.+}} 2
2353 // CK19-DAG: [[SEC2222]] = load double**, double*** [[SEC22222:%[^,]+]],
2354 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}double*** [[SEC222222:[^,]+]], i{{.+}} 0
2355 // CK19-DAG: [[SEC222222]] = load double***, double**** [[PTR]],
2356
2357 // CK19: call void [[CALL42:@.+]](double*** {{[^,]+}})
2358 #pragma omp target map(mptras[:1][2][:13])
2359 {
2360 mptras[1][2][3]++;
2361 }
2362
2363 // Region 43 - the memory is not contiguous for this map - will map the whole last dimension.
2364 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE43]]{{.+}})
2365 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2366 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2367 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2368 //
2369 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2370 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2371 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2372
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002373 // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [11 x [12 x [13 x double]]]**
2374 // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [13 x double]**
2375 // CK19-DAG: store [11 x [12 x [13 x double]]]* [[VAR0:%.+]], [11 x [12 x [13 x double]]]** [[CBP0]]
2376 // CK19-DAG: store [13 x double]* [[SEC0:%.+]], [13 x double]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002377 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002378 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2379 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2380 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2381
2382 // CK19: call void [[CALL43:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2383 #pragma omp target map(marras[1][:ii][1:])
2384 {
2385 marras[1][2][3]++;
2386 }
2387
2388}
2389
2390// CK19: define {{.+}}[[CALL00]]
2391// CK19: define {{.+}}[[CALL01]]
2392// CK19: define {{.+}}[[CALL02]]
2393// CK19: define {{.+}}[[CALL03]]
2394// CK19: define {{.+}}[[CALL04]]
2395// CK19: define {{.+}}[[CALL05]]
2396// CK19: define {{.+}}[[CALL06]]
2397// CK19: define {{.+}}[[CALL07]]
2398// CK19: define {{.+}}[[CALL08]]
2399// CK19: define {{.+}}[[CALL09]]
2400// CK19: define {{.+}}[[CALL10]]
2401// CK19: define {{.+}}[[CALL11]]
2402// CK19: define {{.+}}[[CALL12]]
2403// CK19: define {{.+}}[[CALL13]]
2404// CK19: define {{.+}}[[CALL14]]
2405// CK19: define {{.+}}[[CALL15]]
2406// CK19: define {{.+}}[[CALL16]]
2407// CK19: define {{.+}}[[CALL17]]
2408// CK19: define {{.+}}[[CALL18]]
2409// CK19: define {{.+}}[[CALL19]]
2410// CK19: define {{.+}}[[CALL20]]
2411// CK19: define {{.+}}[[CALL21]]
2412// CK19: define {{.+}}[[CALL22]]
2413// CK19: define {{.+}}[[CALL23]]
2414// CK19: define {{.+}}[[CALL24]]
2415// CK19: define {{.+}}[[CALL25]]
2416// CK19: define {{.+}}[[CALL26]]
2417// CK19: define {{.+}}[[CALL27]]
2418// CK19: define {{.+}}[[CALL28]]
2419// CK19: define {{.+}}[[CALL29]]
2420// CK19: define {{.+}}[[CALL30]]
2421// CK19: define {{.+}}[[CALL31]]
2422// CK19: define {{.+}}[[CALL32]]
2423// CK19: define {{.+}}[[CALL33]]
2424// CK19: define {{.+}}[[CALL34]]
2425// CK19: define {{.+}}[[CALL35]]
2426// CK19: define {{.+}}[[CALL36]]
2427// CK19: define {{.+}}[[CALL37]]
2428// CK19: define {{.+}}[[CALL38]]
2429// CK19: define {{.+}}[[CALL39]]
2430// CK19: define {{.+}}[[CALL40]]
2431// CK19: define {{.+}}[[CALL41]]
2432// CK19: define {{.+}}[[CALL42]]
2433// CK19: define {{.+}}[[CALL43]]
2434
2435#endif
2436///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002437// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-64
2438// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2439// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-64
2440// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-32
2441// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2442// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-32
Samuel Antao86ace552016-04-27 22:40:57 +00002443#ifdef CK20
2444
2445// CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002446// CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002447
2448// CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002449// CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002450
2451// CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002452// CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002453
2454// CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 12]
Samuel Antao6782e942016-05-26 16:48:10 +00002455// CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002456
2457// CK20-LABEL: explicit_maps_references_and_function_args
2458void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){
2459
2460 int &aa = a;
2461 float &bb = b;
2462 int (&cc)[10] = c;
2463 float *&dd = d;
2464
2465 // Region 00
2466 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2467 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2468 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2469
2470 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2471 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002472 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2473 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2474 // CK20-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2475 // CK20-DAG: store i32* [[RVAR00:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002476 // CK20-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2477 // CK20-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2478
2479 // CK20: call void [[CALL00:@.+]](i32* {{[^,]+}})
2480 #pragma omp target map(to:aa)
2481 {
2482 aa += 1;
2483 }
2484
2485 // Region 01
2486 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2487 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2488 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2489
2490 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2491 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002492 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]**
2493 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2494 // CK20-DAG: store [10 x i32]* [[RVAR0:%.+]], [10 x i32]** [[CBP0]]
2495 // CK20-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002496 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0
2497 // CK20-DAG: [[RVAR0]] = load [10 x i32]*, [10 x i32]** [[VAR0:%[^,]+]]
2498 // CK20-DAG: [[RVAR00]] = load [10 x i32]*, [10 x i32]** [[VAR0]]
2499
2500 // CK20: call void [[CALL01:@.+]]([10 x i32]* {{[^,]+}})
2501 #pragma omp target map(to:cc[:5])
2502 {
2503 cc[3] += 1;
2504 }
2505
2506 // Region 02
2507 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2508 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2509 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2510
2511 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2512 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002513 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
2514 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
2515 // CK20-DAG: store float* [[VAR0:%.+]], float** [[CBP0]]
2516 // CK20-DAG: store float* [[VAR0]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002517
2518 // CK20: call void [[CALL02:@.+]](float* {{[^,]+}})
2519 #pragma omp target map(from:b)
2520 {
2521 b += 1.0f;
2522 }
2523
2524 // Region 03
2525 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2526 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2527 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2528
2529 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2530 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002531 // CK20-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
2532 // CK20-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
2533 // CK20-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]]
2534 // CK20-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002535 // CK20-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
2536 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
2537 // CK20-DAG: [[RVAR00]] = load float*, float** [[VAR0]]
2538
2539 // CK20: call void [[CALL03:@.+]](float* {{[^,]+}})
2540 #pragma omp target map(from:d[2:3])
2541 {
2542 d[2] += 1.0f;
2543 }
2544}
2545
2546// CK20: define {{.+}}[[CALL00]]
2547// CK20: define {{.+}}[[CALL01]]
2548// CK20: define {{.+}}[[CALL02]]
2549// CK20: define {{.+}}[[CALL03]]
2550
2551#endif
2552///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002553// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-64
2554// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2555// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-64
2556// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-32
2557// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2558// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-32
Samuel Antao86ace552016-04-27 22:40:57 +00002559#ifdef CK21
2560// CK21: [[ST:%.+]] = type { i32, i32, float* }
2561
2562// CK21: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002563// CK21: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002564
2565// CK21: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
Samuel Antao6782e942016-05-26 16:48:10 +00002566// CK21: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002567
2568// CK21: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 500]
Samuel Antao6782e942016-05-26 16:48:10 +00002569// CK21: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 34, i32 18]
Samuel Antao86ace552016-04-27 22:40:57 +00002570
2571// CK21: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
Samuel Antao6782e942016-05-26 16:48:10 +00002572// CK21: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002573
2574// CK21: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002575// CK21: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002576
2577// CK21: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] 4, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002578// CK21: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 3]
Samuel Antao86ace552016-04-27 22:40:57 +00002579
2580// CK21-LABEL: explicit_maps_template_args_and_members
2581
2582template <int X, typename T>
2583struct CC {
2584 T A;
2585 int A2;
2586 float *B;
2587
2588 int foo(T arg) {
2589 float la[X];
2590 T *lb;
2591
2592 // Region 00
2593 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2594 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2595 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2596
2597 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2598 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002599 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2600 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2601 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2602 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002603 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
2604
2605 // CK21: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
2606 #pragma omp target map(A)
2607 {
2608 A += 1;
2609 }
2610
2611 // Region 01
2612 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2613 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2614 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2615
2616 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2617 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002618 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2619 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2620 // CK21-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2621 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002622 // CK21-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2623 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
2624 // CK21-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2625
2626 // CK21: call void [[CALL01:@.+]](i32* {{[^,]+}})
2627 #pragma omp target map(lb[:X])
2628 {
2629 lb[4] += 1;
2630 }
2631
2632 // Region 02
2633 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
2634 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2635 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2636
2637 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2638 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002639 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2640 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float***
2641 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2642 // CK21-DAG: store float** [[SEC0:%.+]], float*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002643 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2644
2645 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2646 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002647 // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float***
2648 // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
2649 // CK21-DAG: store float** [[SEC0]], float*** [[CBP1]]
2650 // CK21-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002651 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}float* [[RVAR1:%[^,]+]], i{{.+}} 123
2652 // CK21-DAG: [[RVAR1]] = load float*, float** [[SEC1_:%[^,]+]]
2653 // CK21-DAG: [[SEC1_]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2654
2655 // CK21: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}})
2656 #pragma omp target map(from:B[X:X+2])
2657 {
2658 B[2] += 1.0f;
2659 }
2660
2661 // Region 03
2662 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2663 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2664 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2665
2666 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2667 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002668 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [123 x float]**
2669 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [123 x float]**
2670 // CK21-DAG: store [123 x float]* [[VAR0:%.+]], [123 x float]** [[CBP0]]
2671 // CK21-DAG: store [123 x float]* [[VAR0]], [123 x float]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002672
2673 // CK21: call void [[CALL03:@.+]]([123 x float]* {{[^,]+}})
2674 #pragma omp target map(from:la)
2675 {
2676 la[3] += 1.0f;
2677 }
2678
2679 // Region 04
2680 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2681 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2682 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2683
2684 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2685 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002686 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2687 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2688 // CK21-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
2689 // CK21-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002690
2691 // CK21: call void [[CALL04:@.+]](i32* {{[^,]+}})
2692 #pragma omp target map(from:arg)
2693 {
2694 arg +=1;
2695 }
2696
2697 // Make sure the extra flag is passed to the second map.
2698 // Region 05
2699 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
2700 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2701 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2702
2703 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2704 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002705 // CK21-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2706 // CK21-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2707 // CK21-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
2708 // CK21-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002709 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2710
2711 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2712 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002713 // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]**
2714 // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
2715 // CK21-DAG: store [[ST]]* [[VAR1:%.+]], [[ST]]** [[CBP1]]
2716 // CK21-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00002717 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2718
2719 // CK21: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2720 #pragma omp target map(A, A2)
2721 {
2722 A += 1;
2723 A2 += 1;
2724 }
2725 return A;
2726 }
2727};
2728
2729int explicit_maps_template_args_and_members(int a){
2730 CC<123,int> c;
2731 return c.foo(a);
2732}
2733
2734// CK21: define {{.+}}[[CALL00]]
2735// CK21: define {{.+}}[[CALL01]]
2736// CK21: define {{.+}}[[CALL02]]
2737// CK21: define {{.+}}[[CALL03]]
2738// CK21: define {{.+}}[[CALL04]]
2739// CK21: define {{.+}}[[CALL05]]
2740#endif
2741///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002742// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-64
2743// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2744// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-64
2745// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-32
2746// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2747// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-32
Samuel Antao86ace552016-04-27 22:40:57 +00002748#ifdef CK22
2749
2750// CK22-DAG: [[ST:%.+]] = type { float }
2751// CK22-DAG: [[STT:%.+]] = type { i32 }
2752
2753// CK22: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002754// CK22: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002755
2756// CK22: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002757// CK22: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002758
2759// CK22: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002760// CK22: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002761
2762// CK22: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002763// CK22: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002764
2765// CK22: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002766// CK22: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002767
2768// CK22: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002769// CK22: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002770
2771// CK22: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002772// CK22: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002773
2774// CK22: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002775// CK22: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002776
2777// CK22: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002778// CK22: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002779
2780// CK22: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002781// CK22: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002782
2783// CK22: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002784// CK22: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002785
2786// CK22: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002787// CK22: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002788
2789// CK22: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002790// CK22: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002791
2792// CK22: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002793// CK22: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002794
2795// CK22: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002796// CK22: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002797
2798int a;
2799int c[100];
2800int *d;
2801
2802struct ST {
2803 float fa;
2804};
2805
2806ST sa ;
2807ST sc[100];
2808ST *sd;
2809
2810template<typename T>
2811struct STT {
2812 T fa;
2813};
2814
2815STT<int> sta ;
2816STT<int> stc[100];
2817STT<int> *std;
2818
2819// CK22-LABEL: explicit_maps_globals
2820int explicit_maps_globals(void){
2821 // Region 00
2822 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2823 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2824 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2825
2826 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2827 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002828 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2829 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2830 // CK22-DAG: store i32* @a, i32** [[CBP0]]
2831 // CK22-DAG: store i32* @a, i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002832
2833 // CK22: call void [[CALL00:@.+]](i32* {{[^,]+}})
2834 #pragma omp target map(a)
2835 { a+=1; }
2836
2837 // Region 01
2838 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2839 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2840 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2841
2842 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2843 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002844 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
2845 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x i32]**
2846 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]]
2847 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002848
2849 // CK22: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
2850 #pragma omp target map(c)
2851 { c[3]+=1; }
2852
2853 // Region 02
2854 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2855 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2856 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2857
2858 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2859 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002860 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
2861 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
2862 // CK22-DAG: store i32** @d, i32*** [[CBP0]]
2863 // CK22-DAG: store i32** @d, i32*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002864
2865 // CK22: call void [[CALL02:@.+]](i32** {{[^,]+}})
2866 #pragma omp target map(d)
2867 { d[3]+=1; }
2868
2869 // Region 03
2870 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2871 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2872 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2873
2874 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2875 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002876 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x i32]**
2877 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2878 // CK22-DAG: store [100 x i32]* @c, [100 x i32]** [[CBP0]]
2879 // CK22-DAG: store i32* getelementptr inbounds ([100 x i32], [100 x i32]* @c, i{{.+}} 0, i{{.+}} 1), i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002880
2881 // CK22: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
2882 #pragma omp target map(c[1:4])
2883 { c[3]+=1; }
2884
2885 // Region 04
2886 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2887 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2888 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2889
2890 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2891 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002892 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
2893 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
2894 // CK22-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
2895 // CK22-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002896 // CK22-DAG: [[RVAR0]] = load i32*, i32** @d
2897 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 2
2898 // CK22-DAG: [[RVAR00]] = load i32*, i32** @d
2899
2900 // CK22: call void [[CALL04:@.+]](i32* {{[^,]+}})
2901 #pragma omp target map(d[2:5])
2902 { d[3]+=1; }
2903
2904 // Region 05
2905 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
2906 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2907 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2908
2909 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2910 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002911 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2912 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
2913 // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CBP0]]
2914 // CK22-DAG: store [[ST]]* @sa, [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002915
2916 // CK22: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2917 #pragma omp target map(sa)
2918 { sa.fa+=1; }
2919
2920 // Region 06
2921 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
2922 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2923 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2924
2925 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2926 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002927 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]**
2928 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[ST]]]**
2929 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]]
2930 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002931
2932 // CK22: call void [[CALL06:@.+]]([100 x [[ST]]]* {{[^,]+}})
2933 #pragma omp target map(sc)
2934 { sc[3].fa+=1; }
2935
2936 // Region 07
2937 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
2938 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2939 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2940
2941 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2942 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002943 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]***
2944 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]***
2945 // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CBP0]]
2946 // CK22-DAG: store [[ST]]** @sd, [[ST]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002947
2948 // CK22: call void [[CALL07:@.+]]([[ST]]** {{[^,]+}})
2949 #pragma omp target map(sd)
2950 { sd[3].fa+=1; }
2951
2952 // Region 08
2953 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
2954 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2955 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2956
2957 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2958 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002959 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[ST]]]**
2960 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
2961 // CK22-DAG: store [100 x [[ST]]]* @sc, [100 x [[ST]]]** [[CBP0]]
2962 // CK22-DAG: store [[ST]]* getelementptr inbounds ([100 x [[ST]]], [100 x [[ST]]]* @sc, i{{.+}} 0, i{{.+}} 1), [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002963
2964 // CK22: call void [[CALL08:@.+]]([100 x [[ST]]]* {{[^,]+}})
2965 #pragma omp target map(sc[1:4])
2966 { sc[3].fa+=1; }
2967
2968 // Region 09
2969 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
2970 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2971 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2972
2973 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2974 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002975 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
2976 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
2977 // CK22-DAG: store [[ST]]* [[RVAR0:%.+]], [[ST]]** [[CBP0]]
2978 // CK22-DAG: store [[ST]]* [[SEC0:%.+]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002979 // CK22-DAG: [[RVAR0]] = load [[ST]]*, [[ST]]** @sd
2980 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[RVAR00:%.+]], i{{.+}} 2
2981 // CK22-DAG: [[RVAR00]] = load [[ST]]*, [[ST]]** @sd
2982
2983 // CK22: call void [[CALL09:@.+]]([[ST]]* {{[^,]+}})
2984 #pragma omp target map(sd[2:5])
2985 { sd[3].fa+=1; }
2986
2987 // Region 10
2988 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
2989 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2990 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2991
2992 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2993 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00002994 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]**
2995 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
2996 // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CBP0]]
2997 // CK22-DAG: store [[STT]]* @sta, [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00002998
2999 // CK22: call void [[CALL10:@.+]]([[STT]]* {{[^,]+}})
3000 #pragma omp target map(sta)
3001 { sta.fa+=1; }
3002
3003 // Region 11
3004 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
3005 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3006 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3007
3008 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3009 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003010 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]**
3011 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x [[STT]]]**
3012 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]]
3013 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003014
3015 // CK22: call void [[CALL11:@.+]]([100 x [[STT]]]* {{[^,]+}})
3016 #pragma omp target map(stc)
3017 { stc[3].fa+=1; }
3018
3019 // Region 12
3020 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
3021 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3022 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3023
3024 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3025 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003026 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]***
3027 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]***
3028 // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CBP0]]
3029 // CK22-DAG: store [[STT]]** @std, [[STT]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003030
3031 // CK22: call void [[CALL12:@.+]]([[STT]]** {{[^,]+}})
3032 #pragma omp target map(std)
3033 { std[3].fa+=1; }
3034
3035 // Region 13
3036 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
3037 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3038 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3039
3040 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3041 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003042 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x [[STT]]]**
3043 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3044 // CK22-DAG: store [100 x [[STT]]]* @stc, [100 x [[STT]]]** [[CBP0]]
3045 // CK22-DAG: store [[STT]]* getelementptr inbounds ([100 x [[STT]]], [100 x [[STT]]]* @stc, i{{.+}} 0, i{{.+}} 1), [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003046
3047 // CK22: call void [[CALL13:@.+]]([100 x [[STT]]]* {{[^,]+}})
3048 #pragma omp target map(stc[1:4])
3049 { stc[3].fa+=1; }
3050
3051 // Region 14
3052 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
3053 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3054 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3055
3056 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3057 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003058 // CK22-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[STT]]**
3059 // CK22-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[STT]]**
3060 // CK22-DAG: store [[STT]]* [[RVAR0:%.+]], [[STT]]** [[CBP0]]
3061 // CK22-DAG: store [[STT]]* [[SEC0:%.+]], [[STT]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003062 // CK22-DAG: [[RVAR0]] = load [[STT]]*, [[STT]]** @std
3063 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[STT]]* [[RVAR00:%.+]], i{{.+}} 2
3064 // CK22-DAG: [[RVAR00]] = load [[STT]]*, [[STT]]** @std
3065
3066 // CK22: call void [[CALL14:@.+]]([[STT]]* {{[^,]+}})
3067 #pragma omp target map(std[2:5])
3068 { std[3].fa+=1; }
3069
3070 return 0;
3071}
3072// CK22: define {{.+}}[[CALL00]]
3073// CK22: define {{.+}}[[CALL01]]
3074// CK22: define {{.+}}[[CALL02]]
3075// CK22: define {{.+}}[[CALL03]]
3076// CK22: define {{.+}}[[CALL04]]
3077// CK22: define {{.+}}[[CALL05]]
3078// CK22: define {{.+}}[[CALL06]]
3079// CK22: define {{.+}}[[CALL07]]
3080// CK22: define {{.+}}[[CALL08]]
3081// CK22: define {{.+}}[[CALL09]]
3082// CK22: define {{.+}}[[CALL10]]
3083// CK22: define {{.+}}[[CALL11]]
3084// CK22: define {{.+}}[[CALL12]]
3085// CK22: define {{.+}}[[CALL13]]
3086// CK22: define {{.+}}[[CALL14]]
3087#endif
3088///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003089// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-64
3090// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3091// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-64
3092// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-32
3093// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3094// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-32
Samuel Antao86ace552016-04-27 22:40:57 +00003095#ifdef CK23
3096
3097// CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003098// CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003099
3100// CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003101// CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003102
3103// CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00003104// CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003105
3106// CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003107// CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003108
3109// CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00003110// CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003111
3112// CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00003113// CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003114
3115// CK23-LABEL: explicit_maps_inside_captured
3116int explicit_maps_inside_captured(int a){
3117 float b;
3118 float c[100];
3119 float *d;
3120
3121 // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}})
3122 // CK23: define {{.*}}explicit_maps_inside_captured{{.*}}
3123 [&](void){
3124 // Region 00
3125 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
3126 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3127 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3128
3129 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3130 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003131 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
3132 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3133 // CK23-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
3134 // CK23-DAG: store i32* [[VAR00:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003135 // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]]
3136 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3137 // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]]
3138 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3139
3140 // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}})
3141 #pragma omp target map(a)
3142 { a+=1; }
3143 // Region 01
3144 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3145 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3146 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3147
3148 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3149 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003150 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
3151 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3152 // CK23-DAG: store float* [[VAR0:%.+]], float** [[CBP0]]
3153 // CK23-DAG: store float* [[VAR00:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003154 // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]]
3155 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3156 // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]]
3157 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3158
3159 // CK23: call void [[CALL01:@.+]](float* {{[^,]+}})
3160 #pragma omp target map(b)
3161 { b+=1; }
3162 // Region 02
3163 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
3164 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3165 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3166
3167 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3168 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003169 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
3170 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [100 x float]**
3171 // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
3172 // CK23-DAG: store [100 x float]* [[VAR00:%.+]], [100 x float]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003173 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3174 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3175 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3176 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3177
3178 // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}})
3179 #pragma omp target map(c)
3180 { c[3]+=1; }
3181
3182 // Region 03
3183 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
3184 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3185 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3186
3187 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3188 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003189 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float***
3190 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float***
3191 // CK23-DAG: store float** [[VAR0:%.+]], float*** [[CBP0]]
3192 // CK23-DAG: store float** [[VAR00:%.+]], float*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003193 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3194 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3195 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3196 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3197
3198 // CK23: call void [[CALL03:@.+]](float** {{[^,]+}})
3199 #pragma omp target map(d)
3200 { d[3]+=1; }
3201 // Region 04
3202 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
3203 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3204 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3205
3206 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3207 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003208 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [100 x float]**
3209 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3210 // CK23-DAG: store [100 x float]* [[VAR0:%.+]], [100 x float]** [[CBP0]]
3211 // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003212 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3213 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3214 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3215 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3216 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3217
3218 // CK23: call void [[CALL04:@.+]]([100 x float]* {{[^,]+}})
3219 #pragma omp target map(c[2:4])
3220 { c[3]+=1; }
3221
3222 // Region 05
3223 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
3224 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3225 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3226
3227 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3228 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003229 // CK23-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to float**
3230 // CK23-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to float**
3231 // CK23-DAG: store float* [[RVAR0:%.+]], float** [[CBP0]]
3232 // CK23-DAG: store float* [[SEC0:%.+]], float** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003233 // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
3234 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
3235 // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]]
3236 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3237 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3238 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3239 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3240
3241 // CK23: call void [[CALL05:@.+]](float* {{[^,]+}})
3242 #pragma omp target map(d[2:4])
3243 { d[3]+=1; }
3244 }();
3245 return b;
3246}
3247
3248// CK23: define {{.+}}[[CALL00]]
3249// CK23: define {{.+}}[[CALL01]]
3250// CK23: define {{.+}}[[CALL02]]
3251// CK23: define {{.+}}[[CALL03]]
3252// CK23: define {{.+}}[[CALL04]]
3253// CK23: define {{.+}}[[CALL05]]
3254#endif
3255///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003256// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-64
3257// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3258// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-64
3259// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-32
3260// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3261// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-32
Samuel Antao86ace552016-04-27 22:40:57 +00003262#ifdef CK24
3263
3264// CK24-DAG: [[SC:%.+]] = type { i32, [[SB:%.+]], [[SB:%.+]]*, [10 x i32] }
3265// CK24-DAG: [[SB]] = type { i32, [[SA:%.+]], [10 x [[SA:%.+]]], [10 x [[SA:%.+]]*], [[SA:%.+]]* }
3266// CK24-DAG: [[SA]] = type { i32, [[SA]]*, [10 x i32] }
3267
3268struct SA{
3269 int a;
3270 struct SA *p;
3271 int b[10];
3272};
3273struct SB{
3274 int a;
3275 struct SA s;
3276 struct SA sa[10];
3277 struct SA *sp[10];
3278 struct SA *p;
3279};
3280struct SC{
3281 int a;
3282 struct SB s;
3283 struct SB *p;
3284 int b[10];
3285};
3286
3287// CK24: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003288// CK24: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003289
3290// CK24: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003291// CK24: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003292
3293// CK24: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003294// CK24: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003295
3296// CK24: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00003297// CK24: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003298
3299// CK24: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003300// CK24: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003301
3302// CK24: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003303// CK24: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003304
3305// CK24: [[SIZE07:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003306// CK24: [[MTYPE07:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003307
3308// CK24: [[SIZE08:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003309// CK24: [[MTYPE08:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003310
3311// CK24: [[SIZE09:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003312// CK24: [[MTYPE09:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003313
3314// CK24: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 8]
Samuel Antao6782e942016-05-26 16:48:10 +00003315// CK24: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003316
3317// CK24: [[SIZE11:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003318// CK24: [[MTYPE11:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003319
3320// CK24: [[SIZE12:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003321// CK24: [[MTYPE12:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 19, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003322
3323// CK24: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003324// CK24: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003325
3326// CK24: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003327// CK24: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003328
3329// CK24: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003330// CK24: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003331
3332// CK24: [[SIZE16:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00003333// CK24: [[MTYPE16:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003334
3335// CK24: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003336// CK24: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003337
3338// CK24: [[SIZE18:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003339// CK24: [[MTYPE18:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003340
3341// CK24: [[SIZE19:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003342// CK24: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003343
3344// CK24: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003345// CK24: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003346
3347// CK24: [[SIZE21:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003348// CK24: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003349
3350// CK24: [[SIZE22:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003351// CK24: [[MTYPE22:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003352
3353// CK24: [[SIZE23:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003354// CK24: [[MTYPE23:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003355
3356// CK24: [[SIZE24:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003357// CK24: [[MTYPE24:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 19, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003358
3359// CK24-LABEL: explicit_maps_struct_fields
3360int explicit_maps_struct_fields(int a){
3361 SC s;
3362 SC *p;
3363
3364// Region 01
3365// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3366// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3367// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3368
3369// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3370// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003371// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3372// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3373// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3374// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003375// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
3376
3377// CK24: call void [[CALL01:@.+]]([[SC]]* {{[^,]+}})
3378#pragma omp target map(s.a)
3379 { s.a++; }
3380
3381// Region 02
3382// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
3383// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3384// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3385
3386// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3387// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003388// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3389// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]**
3390// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3391// CK24-DAG: store [[SA]]* [[SEC0:%.+]], [[SA]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003392// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3393// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3394
3395// CK24: call void [[CALL02:@.+]]([[SC]]* {{[^,]+}})
3396#pragma omp target map(s.s.s)
3397 { s.a++; }
3398
3399// Region 03
3400// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
3401// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3402// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3403
3404// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3405// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003406// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3407// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3408// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3409// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003410// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3411// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3412// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3413
3414// CK24: call void [[CALL03:@.+]]([[SC]]* {{[^,]+}})
3415#pragma omp target map(s.s.s.a)
3416 { s.a++; }
3417
3418// Region 04
3419// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
3420// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3421// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3422
3423// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3424// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003425// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3426// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3427// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3428// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003429// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3430// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 3
3431
3432// CK24: call void [[CALL04:@.+]]([[SC]]* {{[^,]+}})
3433#pragma omp target map(s.b[:5])
3434 { s.a++; }
3435
3436// Region 05
3437// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
3438// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3439// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3440
3441// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3442// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003443// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3444// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3445// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3446// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003447// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3448
3449// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3450// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003451// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3452// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SB]]**
3453// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3454// CK24-DAG: store [[SB]]* [[SEC1:%.+]], [[SB]]** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003455// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3456// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3457// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3458
3459// CK24: call void [[CALL05:@.+]]([[SC]]* {{[^,]+}})
3460#pragma omp target map(s.p[:5])
3461 { s.a++; }
3462
3463// Region 06
3464// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
3465// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3466// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3467
3468// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3469// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003470// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3471// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3472// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3473// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003474// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3475// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3476// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3477// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3478
3479// CK24: call void [[CALL06:@.+]]([[SC]]* {{[^,]+}})
3480#pragma omp target map(s.s.sa[3].a)
3481 { s.a++; }
3482
3483// Region 07
3484// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE07]]{{.+}})
3485// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3486// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3487
3488// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3489// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003490// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3491// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3492// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3493// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003494// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3495// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3496// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3497
3498// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3499// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003500// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3501// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3502// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3503// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003504// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3505// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3506// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3507// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3508// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3509
3510// CK24: call void [[CALL07:@.+]]([[SC]]* {{[^,]+}})
3511#pragma omp target map(s.s.sp[3]->a)
3512 { s.a++; }
3513
3514// Region 08
3515// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE08]]{{.+}})
3516// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3517// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3518
3519// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3520// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003521// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3522// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3523// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3524// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003525// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3526
3527// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3528// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003529// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3530// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3531// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3532// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003533// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3534// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3535// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3536
3537// CK24: call void [[CALL08:@.+]]([[SC]]* {{[^,]+}})
3538#pragma omp target map(s.p->a)
3539 { s.a++; }
3540
3541// Region 09
3542// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE09]]{{.+}})
3543// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3544// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3545
3546// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3547// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003548// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3549// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3550// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3551// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003552// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3553// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3554
3555// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3556// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003557// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3558// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3559// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3560// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003561// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3562// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3563// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3564// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3565
3566// CK24: call void [[CALL09:@.+]]([[SC]]* {{[^,]+}})
3567#pragma omp target map(s.s.p->a)
3568 { s.a++; }
3569
3570// Region 10
3571// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
3572// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3573// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3574
3575// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3576// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003577// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3578// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3579// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3580// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003581// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3582// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3583// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3584// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3585
3586// CK24: call void [[CALL10:@.+]]([[SC]]* {{[^,]+}})
3587#pragma omp target map(s.s.s.b[:2])
3588 { s.a++; }
3589
3590// Region 11
3591// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE11]]{{.+}})
3592// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3593// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3594
3595// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3596// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003597// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3598// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3599// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3600// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003601// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3602// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3603
3604// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3605// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003606// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3607// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3608// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3609// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003610// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3611// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3612// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3613// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3614// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3615
3616// CK24: call void [[CALL11:@.+]]([[SC]]* {{[^,]+}})
3617#pragma omp target map(s.s.p->b[:2])
3618 { s.a++; }
3619
3620// Region 12
3621// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE12]]{{.+}})
3622// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3623// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3624
3625// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3626// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003627// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3628// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3629// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3630// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003631// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3632
3633// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3634// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003635// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3636// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]***
3637// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CBP1]]
3638// CK24-DAG: store [[SA]]** [[SEC1:%.+]], [[SA]]*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003639// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3640// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3641// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3642
3643// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3644// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003645// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]***
3646// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [[SA]]***
3647// CK24-DAG: store [[SA]]** [[SEC1:%.+]], [[SA]]*** [[CBP2]]
3648// CK24-DAG: store [[SA]]** [[SEC2:%.+]], [[SA]]*** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00003649// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3650// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
3651// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3652// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
3653// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3654
3655// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
3656// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003657// CK24-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to [[SA]]***
3658// CK24-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32**
3659// CK24-DAG: store [[SA]]** [[SEC2]], [[SA]]*** [[CBP3]]
3660// CK24-DAG: store i32* [[SEC3:%.+]], i32** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00003661// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3662// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
3663// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3664// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
3665// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3666// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
3667// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3668
3669// CK24: call void [[CALL12:@.+]]([[SC]]* {{[^,]+}})
3670#pragma omp target map(s.p->p->p->a)
3671 { s.a++; }
3672
3673//
3674// Same thing but starting from a pointer.
3675//
3676// Region 13
3677// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
3678// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3679// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3680
3681// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3682// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003683// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3684// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3685// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3686// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003687// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 0
3688
3689// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3690// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3691
3692// CK24: call void [[CALL13:@.+]]([[SC]]* {{[^,]+}})
3693#pragma omp target map(p->a)
3694 { p->a++; }
3695
3696// Region 14
3697// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
3698// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3699// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3700
3701// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3702// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003703// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3704// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]**
3705// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3706// CK24-DAG: store [[SA]]* [[SEC0:%.+]], [[SA]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003707// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3708// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3709
3710// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3711// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3712
3713// CK24: call void [[CALL14:@.+]]([[SC]]* {{[^,]+}})
3714#pragma omp target map(p->s.s)
3715 { p->a++; }
3716
3717// Region 15
3718// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
3719// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3720// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3721
3722// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3723// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003724// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3725// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3726// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3727// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003728// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3729// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3730// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3731
3732// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3733// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3734
3735// CK24: call void [[CALL15:@.+]]([[SC]]* {{[^,]+}})
3736#pragma omp target map(p->s.s.a)
3737 { p->a++; }
3738
3739// Region 16
3740// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE16]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE16]]{{.+}})
3741// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3742// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3743
3744// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3745// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003746// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3747// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3748// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3749// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003750// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3751// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 3
3752
3753// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3754// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3755
3756// CK24: call void [[CALL16:@.+]]([[SC]]* {{[^,]+}})
3757#pragma omp target map(p->b[:5])
3758 { p->a++; }
3759
3760// Region 17
3761// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
3762// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3763// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3764
3765// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3766// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003767// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3768// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3769// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3770// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003771// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3772
3773// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3774// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003775// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3776// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SB]]**
3777// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3778// CK24-DAG: store [[SB]]* [[SEC1:%.+]], [[SB]]** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003779// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3780// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3781// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3782
3783// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3784// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3785// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3786
3787// CK24: call void [[CALL17:@.+]]([[SC]]* {{[^,]+}})
3788#pragma omp target map(p->p[:5])
3789 { p->a++; }
3790
3791// Region 18
3792// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE18]]{{.+}})
3793// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3794// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3795
3796// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3797// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003798// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3799// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3800// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3801// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003802// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3803// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3804// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3805// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3806
3807// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3808// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3809
3810// CK24: call void [[CALL18:@.+]]([[SC]]* {{[^,]+}})
3811#pragma omp target map(p->s.sa[3].a)
3812 { p->a++; }
3813
3814// Region 19
3815// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE19]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
3816// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3817// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3818
3819// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3820// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003821// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3822// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3823// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3824// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003825// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3826// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3827// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3828
3829// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3830// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003831// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3832// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3833// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3834// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003835// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3836// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3837// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3838// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3839// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3840
3841// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3842// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3843// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3844
3845// CK24: call void [[CALL19:@.+]]([[SC]]* {{[^,]+}})
3846#pragma omp target map(p->s.sp[3]->a)
3847 { p->a++; }
3848
3849// Region 20
3850// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
3851// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3852// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3853
3854// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3855// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003856// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3857// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3858// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3859// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003860// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3861
3862// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3863// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003864// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3865// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3866// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3867// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003868// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3869// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3870// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3871
3872// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3873// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3874// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3875
3876// CK24: call void [[CALL20:@.+]]([[SC]]* {{[^,]+}})
3877#pragma omp target map(p->p->a)
3878 { p->a++; }
3879
3880// Region 21
3881// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE21]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
3882// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3883// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3884
3885// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3886// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003887// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3888// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3889// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3890// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003891// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3892// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3893
3894// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3895// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003896// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3897// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3898// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3899// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003900// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3901// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3902// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3903// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3904
3905// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3906// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3907// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3908
3909// CK24: call void [[CALL21:@.+]]([[SC]]* {{[^,]+}})
3910#pragma omp target map(p->s.p->a)
3911 { p->a++; }
3912
3913// Region 22
3914// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE22]]{{.+}})
3915// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3916// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3917
3918// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3919// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003920// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3921// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
3922// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3923// CK24-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003924// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3925// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3926// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3927// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3928
3929// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3930// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3931
3932// CK24: call void [[CALL22:@.+]]([[SC]]* {{[^,]+}})
3933#pragma omp target map(p->s.s.b[:2])
3934 { p->a++; }
3935
3936// Region 23
3937// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE23]]{{.+}})
3938// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3939// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3940
3941// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3942// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003943// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3944// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SA]]***
3945// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3946// CK24-DAG: store [[SA]]** [[SEC0:%.+]], [[SA]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003947// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3948// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3949
3950// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3951// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003952// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SA]]***
3953// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
3954// CK24-DAG: store [[SA]]** [[SEC0]], [[SA]]*** [[CBP1]]
3955// CK24-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003956// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3957// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3958// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3959// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3960// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3961
3962// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3963// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3964// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3965
3966// CK24: call void [[CALL23:@.+]]([[SC]]* {{[^,]+}})
3967#pragma omp target map(p->s.p->b[:2])
3968 { p->a++; }
3969
3970// Region 24
3971// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE24]]{{.+}})
3972// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3973// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3974
3975// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3976// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003977// CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SC]]**
3978// CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SB]]***
3979// CK24-DAG: store [[SC]]* [[VAR0:%.+]], [[SC]]** [[CBP0]]
3980// CK24-DAG: store [[SB]]** [[SEC0:%.+]], [[SB]]*** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00003981// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3982
3983// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3984// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003985// CK24-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SB]]***
3986// CK24-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SA]]***
3987// CK24-DAG: store [[SB]]** [[SEC0]], [[SB]]*** [[CBP1]]
3988// CK24-DAG: store [[SA]]** [[SEC1:%.+]], [[SA]]*** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00003989// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3990// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3991// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3992
3993// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3994// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00003995// CK24-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SA]]***
3996// CK24-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to [[SA]]***
3997// CK24-DAG: store [[SA]]** [[SEC1]], [[SA]]*** [[CBP2]]
3998// CK24-DAG: store [[SA]]** [[SEC2:%.+]], [[SA]]*** [[CP2]]
Samuel Antao86ace552016-04-27 22:40:57 +00003999// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
4000// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
4001// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
4002// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
4003// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0000:%.+]], i{{.+}} 0, i{{.+}} 2
4004
4005// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4006// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004007// CK24-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to [[SA]]***
4008// CK24-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to i32**
4009// CK24-DAG: store [[SA]]** [[SEC2]], [[SA]]*** [[CBP3]]
4010// CK24-DAG: store i32* [[SEC3:%.+]], i32** [[CP3]]
Samuel Antao86ace552016-04-27 22:40:57 +00004011// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
4012// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
4013// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
4014// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
4015// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
4016// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
4017// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR00000:%.+]], i{{.+}} 0, i{{.+}} 2
4018
4019// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
4020// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
4021// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
4022// CK24-DAG: [[VAR0000]] = load [[SC]]*, [[SC]]** %{{.+}}
4023// CK24-DAG: [[VAR00000]] = load [[SC]]*, [[SC]]** %{{.+}}
4024
4025// CK24: call void [[CALL24:@.+]]([[SC]]* {{[^,]+}})
4026#pragma omp target map(p->p->p->p->a)
4027 { p->a++; }
4028
4029 return s.a;
4030}
4031
4032// CK24: define {{.+}}[[CALL01]]
4033// CK24: define {{.+}}[[CALL02]]
4034// CK24: define {{.+}}[[CALL03]]
4035// CK24: define {{.+}}[[CALL04]]
4036// CK24: define {{.+}}[[CALL05]]
4037// CK24: define {{.+}}[[CALL06]]
4038// CK24: define {{.+}}[[CALL07]]
4039// CK24: define {{.+}}[[CALL08]]
4040// CK24: define {{.+}}[[CALL09]]
4041// CK24: define {{.+}}[[CALL10]]
4042// CK24: define {{.+}}[[CALL11]]
4043// CK24: define {{.+}}[[CALL12]]
4044// CK24: define {{.+}}[[CALL13]]
4045// CK24: define {{.+}}[[CALL14]]
4046// CK24: define {{.+}}[[CALL15]]
4047// CK24: define {{.+}}[[CALL16]]
4048// CK24: define {{.+}}[[CALL17]]
4049// CK24: define {{.+}}[[CALL18]]
4050// CK24: define {{.+}}[[CALL19]]
4051// CK24: define {{.+}}[[CALL20]]
4052// CK24: define {{.+}}[[CALL21]]
4053// CK24: define {{.+}}[[CALL22]]
4054// CK24: define {{.+}}[[CALL23]]
4055// CK24: define {{.+}}[[CALL24]]
4056#endif
4057///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004058// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-64
4059// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4060// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-64
4061// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-32
4062// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4063// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-32
Samuel Antao86ace552016-04-27 22:40:57 +00004064#ifdef CK25
4065// CK25: [[ST:%.+]] = type { i32, float }
4066// CK25: [[CA00:%.+]] = type { [[ST]]* }
4067// CK25: [[CA01:%.+]] = type { i32* }
4068
4069// CK25: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004070// CK25: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00004071
4072// CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004073// CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00004074
4075// CK25-LABEL: explicit_maps_with_inner_lambda
4076
4077template <int X, typename T>
4078struct CC {
4079 T A;
4080 float B;
4081
4082 int foo(T arg) {
4083 // Region 00
4084 // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4085 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4086 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4087
4088 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4089 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004090 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4091 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4092 // CK25-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4093 // CK25-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004094 // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
4095
4096 // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
4097 #pragma omp target map(to:A)
4098 {
4099 [&]() {
4100 A += 1;
4101 }();
4102 }
4103
4104 // Region 01
4105 // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4106 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4107 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4108
4109 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4110 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004111 // CK25-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4112 // CK25-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4113 // CK25-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4114 // CK25-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004115
4116 // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}})
4117 #pragma omp target map(to:arg)
4118 {
4119 [&]() {
4120 arg += 1;
4121 }();
4122 }
4123
4124 return A+arg;
4125 }
4126};
4127
4128int explicit_maps_with_inner_lambda(int a){
4129 CC<123,int> c;
4130 return c.foo(a);
4131}
4132
4133// CK25: define {{.+}}[[CALL00]]([[ST]]* [[VAL:%.+]])
4134// CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]],
4135// CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]],
4136// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0
4137// CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]],
4138// CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* [[CA]])
4139
4140// CK25: define {{.+}}[[LAMBDA]]
4141
4142// CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]])
4143// CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]],
4144// CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]],
4145// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0
4146// CK25: store i32* [[VAL1]], i32** [[VALADDR1]],
Alexey Bataevbef6aa62016-10-14 12:43:59 +00004147// CK25: call void {{.*}}[[LAMBDA2:@.+]]{{.*}}([[CA01]]* [[CA]])
4148
4149// CK25: define {{.+}}[[LAMBDA2]]
Samuel Antao86ace552016-04-27 22:40:57 +00004150#endif
4151///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004152// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
4153// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4154// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
4155// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
4156// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4157// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
Samuel Antao86ace552016-04-27 22:40:57 +00004158#ifdef CK26
4159// CK26: [[ST:%.+]] = type { i32, float*, i32, float* }
4160
4161// CK26: [[SIZE00:@.+]] = private {{.*}}constant [2 x i[[Z:64|32]]] [i[[Z:64|32]] {{32|16}}, i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004162// CK26: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004163
4164// CK26: [[SIZE01:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004165// CK26: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004166
4167// CK26: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004168// CK26: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004169
4170// CK26: [[SIZE03:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004171// CK26: [[MTYPE03:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004172
4173// CK26-LABEL: explicit_maps_with_private_class_members
4174
4175struct CC {
4176 int fA;
4177 float &fB;
4178 int pA;
4179 float &pB;
4180
4181 CC(float &B) : fB(B), pB(B) {
4182
4183 // CK26: call {{.*}}@__kmpc_fork_call{{.*}} [[OUTCALL:@.+]] to void (i32*, i32*, ...)*
4184 // define {{.*}}void [[OUTCALL]]
4185 #pragma omp parallel firstprivate(fA,fB) private(pA,pB)
4186 {
4187 // Region 00
4188 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}})
4189 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4190 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4191
4192 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4193 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004194 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4195 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4196 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4197 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004198
4199 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4200 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004201 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
4202 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4203 // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
4204 // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004205 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4206 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4207
4208 // CK26: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4209 #pragma omp target map(fA)
4210 {
4211 ++fA;
4212 }
4213
4214 // Region 01
4215 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}})
4216 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4217 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4218
4219 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4220 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004221 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4222 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4223 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4224 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004225
4226 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4227 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004228 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float**
4229 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
4230 // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]]
4231 // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004232 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4233 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4234
4235 // CK26: call void [[CALL01:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4236 #pragma omp target map(fB)
4237 {
4238 fB += 1.0;
4239 }
4240
4241 // Region 02
4242 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
4243 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4244 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4245
4246 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4247 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004248 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4249 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4250 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4251 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004252
4253 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4254 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004255 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32**
4256 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32**
4257 // CK26-DAG: store i32* [[VAR1:%.+]], i32** [[CBP1]]
4258 // CK26-DAG: store i32* [[SEC1:%.+]], i32** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004259 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4260 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4261
4262 // CK26: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4263 #pragma omp target map(pA)
4264 {
4265 ++pA;
4266 }
4267
4268 // Region 01
4269 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE03]]{{.+}})
4270 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4271 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4272
4273 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4274 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004275 // CK26-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[ST]]**
4276 // CK26-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[ST]]**
4277 // CK26-DAG: store [[ST]]* [[VAR0:%.+]], [[ST]]** [[CBP0]]
4278 // CK26-DAG: store [[ST]]* [[VAR0]], [[ST]]** [[CP0]]
Samuel Antao86ace552016-04-27 22:40:57 +00004279
4280 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4281 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004282 // CK26-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float**
4283 // CK26-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float**
4284 // CK26-DAG: store float* [[VAR1:%.+]], float** [[CBP1]]
4285 // CK26-DAG: store float* [[SEC1:%.+]], float** [[CP1]]
Samuel Antao86ace552016-04-27 22:40:57 +00004286 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4287 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4288
4289 // CK26: call void [[CALL03:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4290 #pragma omp target map(pB)
4291 {
4292 pB += 1.0;
4293 }
4294 }
4295 }
4296
4297 int foo() {
4298 return fA + pA;
4299 }
4300};
4301
4302// Make sure the private instance is used in all target regions.
4303// CK26: define {{.+}}[[CALL00]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4304// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4305// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4306// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4307// CK26: add nsw i32 [[VAL]], 1
4308
4309// CK26: define {{.+}}[[CALL01]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4310// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4311// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4312// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4313// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4314// CK26: fadd double [[EXT]], 1.000000e+00
4315
4316// CK26: define {{.+}}[[CALL02]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4317// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4318// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4319// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4320// CK26: add nsw i32 [[VAL]], 1
4321
4322// CK26: define {{.+}}[[CALL03]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4323// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4324// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4325// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4326// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4327// CK26: fadd double [[EXT]], 1.000000e+00
4328
4329int explicit_maps_with_private_class_members(){
4330 float B;
4331 CC c(B);
4332 return c.foo();
4333}
4334#endif
Samuel Antao6782e942016-05-26 16:48:10 +00004335///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004336// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-64
4337// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4338// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-64
4339// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-32
4340// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4341// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-32
Samuel Antao6782e942016-05-26 16:48:10 +00004342#ifdef CK27
4343
4344// CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] zeroinitializer
4345// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
4346
4347// CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4348// CK27: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4349
4350// CK27: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4351// CK27: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4352
4353// CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4354// CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4355
Samuel Antaod486f842016-05-26 16:53:38 +00004356// CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4357// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
4358
4359// CK27: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
4360// CK27: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 288]
4361
4362// CK27: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 40]
4363// CK27: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 161]
4364
4365// CK27-LABEL: zero_size_section_and_private_maps
4366void zero_size_section_and_private_maps (int ii){
Samuel Antao6782e942016-05-26 16:48:10 +00004367
4368 // Map of a pointer.
4369 int *pa;
4370
4371 // Region 00
4372 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4373 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4374 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4375
4376 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4377 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004378 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4379 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4380 // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4381 // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004382
4383 // CK27: call void [[CALL00:@.+]](i32* {{[^,]+}})
4384 #pragma omp target
4385 {
4386 pa[50]++;
4387 }
4388
4389 // Region 01
4390 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4391 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4392 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4393
4394 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4395 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004396 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4397 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4398 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4399 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004400 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4401 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4402 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4403
4404 // CK27: call void [[CALL01:@.+]](i32* {{[^,]+}})
4405 #pragma omp target map(pa[:0])
4406 {
4407 pa[50]++;
4408 }
4409
4410 // Region 02
4411 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
4412 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4413 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4414
4415 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4416 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004417 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4418 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4419 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4420 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004421 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4422 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4423 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4424
4425 // CK27: call void [[CALL02:@.+]](i32* {{[^,]+}})
4426 #pragma omp target map(pa[0:0])
4427 {
4428 pa[50]++;
4429 }
4430
4431 // Region 03
4432 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
4433 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4434 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4435
4436 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4437 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004438 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4439 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4440 // CK27-DAG: store i32* [[RVAR0:%.+]], i32** [[CBP0]]
4441 // CK27-DAG: store i32* [[SEC0:%.+]], i32** [[CP0]]
Samuel Antao6782e942016-05-26 16:48:10 +00004442 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4443 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.+}}
4444 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4445
4446 // CK27: call void [[CALL03:@.+]](i32* {{[^,]+}})
4447 #pragma omp target map(pa[ii:0])
4448 {
4449 pa[50]++;
4450 }
Samuel Antaod486f842016-05-26 16:53:38 +00004451
4452 int *pvtPtr;
4453 int pvtScl;
4454 int pvtArr[10];
4455
4456 // Region 04
4457 // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4458 // CK27: call void [[CALL04:@.+]]()
4459 #pragma omp target private(pvtPtr)
4460 {
4461 pvtPtr[5]++;
4462 }
4463
4464 // Region 05
4465 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
4466 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4467 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4468
4469 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4470 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004471 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4472 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4473 // CK27-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4474 // CK27-DAG: store i32* [[VAR0]], i32** [[CP0]]
Samuel Antaod486f842016-05-26 16:53:38 +00004475
4476 // CK27: call void [[CALL05:@.+]](i32* {{[^,]+}})
4477 #pragma omp target firstprivate(pvtPtr)
4478 {
4479 pvtPtr[5]++;
4480 }
4481
4482 // Region 06
4483 // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4484 // CK27: call void [[CALL06:@.+]]()
4485 #pragma omp target private(pvtScl)
4486 {
4487 pvtScl++;
4488 }
4489
4490 // Region 07
4491 // CK27-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZE07]]{{.+}}, {{.+}}[[MTYPE07]]{{.+}})
4492 // CK27-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
4493 // CK27-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
4494 // CK27-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
4495 // CK27-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004496 // CK27-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[Z]]*
4497 // CK27-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[Z]]*
4498 // CK27-DAG: store i[[Z]] [[VAL:%.+]], i[[Z]]* [[CBP1]]
4499 // CK27-DAG: store i[[Z]] [[VAL]], i[[Z]]* [[CP1]]
Samuel Antaod486f842016-05-26 16:53:38 +00004500 // CK27-DAG: [[VAL]] = load i[[Z]], i[[Z]]* [[ADDR:%.+]],
4501 // CK27-64-DAG: [[CADDR:%.+]] = bitcast i[[Z]]* [[ADDR]] to i32*
4502 // CK27-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
4503
4504 // CK27: call void [[CALL07:@.+]](i[[Z]] [[VAL]])
4505 #pragma omp target firstprivate(pvtScl)
4506 {
4507 pvtScl++;
4508 }
4509
4510 // Region 08
4511 // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4512 // CK27: call void [[CALL08:@.+]]()
4513 #pragma omp target private(pvtArr)
4514 {
4515 pvtArr[5]++;
4516 }
4517
4518 // Region 09
4519 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
4520 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4521 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4522
4523 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4524 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004525 // CK27-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]**
4526 // CK27-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [10 x i32]**
4527 // CK27-DAG: store [10 x i32]* [[VAR0:%.+]], [10 x i32]** [[CBP0]]
4528 // CK27-DAG: store [10 x i32]* [[VAR0]], [10 x i32]** [[CP0]]
Samuel Antaod486f842016-05-26 16:53:38 +00004529
4530 // CK27: call void [[CALL09:@.+]]([10 x i32]* {{[^,]+}})
4531 #pragma omp target firstprivate(pvtArr)
4532 {
4533 pvtArr[5]++;
4534 }
Samuel Antao6782e942016-05-26 16:48:10 +00004535}
4536
4537// CK27: define {{.+}}[[CALL00]]
4538// CK27: define {{.+}}[[CALL01]]
4539// CK27: define {{.+}}[[CALL02]]
4540// CK27: define {{.+}}[[CALL03]]
Samuel Antaod486f842016-05-26 16:53:38 +00004541// CK27: define {{.+}}[[CALL04]]
4542// CK27: define {{.+}}[[CALL05]]
4543// CK27: define {{.+}}[[CALL06]]
4544// CK27: define {{.+}}[[CALL07]]
Samuel Antao6782e942016-05-26 16:48:10 +00004545#endif
Samuel Antao403ffd42016-07-27 22:49:49 +00004546///==========================================================================///
4547// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-64
4548// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4549// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-64
4550// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-32
4551// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4552// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-32
4553#ifdef CK28
4554
4555// CK28: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] {{8|4}}]
4556// CK28: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4557
4558// CK28: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
4559// CK28: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4560
4561// CK28-LABEL: explicit_maps_pointer_references
4562void explicit_maps_pointer_references (int *p){
4563 int *&a = p;
4564
4565 // Region 00
4566 // CK28-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4567 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4568 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4569
4570 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4571 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004572 // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32***
4573 // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32***
4574 // CK28-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]]
4575 // CK28-DAG: store i32** [[VAR1:%.+]], i32*** [[CP0]]
Samuel Antao403ffd42016-07-27 22:49:49 +00004576 // CK28-DAG: [[VAR0]] = load i32**, i32*** [[VAR00:%.+]],
4577 // CK28-DAG: [[VAR1]] = load i32**, i32*** [[VAR11:%.+]],
4578
4579 // CK28: call void [[CALL00:@.+]](i32** {{[^,]+}})
4580 #pragma omp target map(a)
4581 {
4582 ++a;
4583 }
4584
4585 // Region 01
4586 // CK28-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4587 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4588 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4589
4590 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4591 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004592 // CK28-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
4593 // CK28-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
4594 // CK28-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
4595 // CK28-DAG: store i32* [[VAR1:%.+]], i32** [[CP0]]
Samuel Antao403ffd42016-07-27 22:49:49 +00004596 // CK28-DAG: [[VAR0]] = load i32*, i32** [[VAR00:%.+]],
4597 // CK28-DAG: [[VAR00]] = load i32**, i32*** [[VAR000:%.+]],
4598 // CK28-DAG: [[VAR1]] = getelementptr inbounds i32, i32* [[VAR11:%.+]], i{{64|32}} 2
4599 // CK28-DAG: [[VAR11]] = load i32*, i32** [[VAR111:%.+]],
4600 // CK28-DAG: [[VAR111]] = load i32**, i32*** [[VAR1111:%.+]],
4601
4602 // CK28: call void [[CALL01:@.+]](i32* {{[^,]+}})
4603 #pragma omp target map(a[2:100])
4604 {
4605 ++a;
4606 }
4607}
4608#endif
Samuel Antao03a3cec2016-07-27 22:52:16 +00004609///==========================================================================///
4610// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-64
4611// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4612// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-64
4613// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-32
4614// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4615// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-32
4616#ifdef CK29
4617
4618// CK29: [[SSA:%.+]] = type { double*, double** }
4619// CK29: [[SSB:%.+]] = type { [[SSA]]*, [[SSA]]** }
4620
4621// CK29: [[SIZE00:@.+]] = private {{.*}}constant [4 x i[[Z:64|32]]] [i[[Z:64|32]] {{8|4}}, i[[Z:64|32]] {{8|4}}, i[[Z:64|32]] {{8|4}}, i[[Z:64|32]] 80]
4622// CK29: [[MTYPE00:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 16, i32 19, i32 19]
4623
4624// CK29: [[SIZE01:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 80]
4625// CK29: [[MTYPE01:@.+]] = private {{.*}}constant [4 x i32] [i32 32, i32 19, i32 19, i32 19]
4626
4627// CK29: [[SIZE02:@.+]] = private {{.*}}constant [5 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 80]
4628// CK29: [[MTYPE02:@.+]] = private {{.*}}constant [5 x i32] [i32 32, i32 19, i32 16, i32 19, i32 19]
4629
4630struct SSA{
4631 double *p;
4632 double *&pr;
4633 SSA(double *&pr) : pr(pr) {}
4634};
4635
4636struct SSB{
4637 SSA *p;
4638 SSA *&pr;
4639 SSB(SSA *&pr) : pr(pr) {}
4640
4641 // CK29-LABEL: define {{.+}}foo
4642 void foo() {
4643
4644 // Region 00
4645 // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE00]]{{.+}})
4646
4647 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4648 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4649
4650 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4651 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004652 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4653 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]**
4654 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4655 // CK29-DAG: store [[SSA]]** [[VAR00:%.+]], [[SSA]]*** [[CP0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004656 // CK29-DAG: [[VAR0]] = load [[SSB]]*, [[SSB]]** %
4657 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 0
4658
4659 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4660 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004661 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]***
4662 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double****
4663 // CK29-DAG: store [[SSA]]** [[VAR00]], [[SSA]]*** [[CBP1]]
4664 // CK29-DAG: store double*** [[VAR1:%.+]], double**** [[CP1]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004665 // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4666
4667 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4668 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004669 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double****
4670 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double***
4671 // CK29-DAG: store double*** [[VAR1]], double**** [[CBP2]]
4672 // CK29-DAG: store double** [[VAR2:%.+]], double*** [[CP2]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004673 // CK29-DAG: [[VAR2]] = load double**, double*** [[VAR22:%.+]],
4674 // CK29-DAG: [[VAR22]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4675
4676 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4677 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004678 // CK29-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double***
4679 // CK29-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
4680 // CK29-DAG: store double** [[VAR2]], double*** [[CBP3]]
4681 // CK29-DAG: store double* [[VAR3:%.+]], double** [[CP3]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004682 // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4683 // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4684
4685 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4686 #pragma omp target map(p->pr[:10])
4687 {
4688 p->pr++;
4689 }
4690
4691 // Region 01
4692 // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE01]]{{.+}})
4693
4694 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4695 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4696
4697 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4698 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004699 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4700 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]****
4701 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4702 // CK29-DAG: store [[SSA]]*** [[VAR00:%.+]], [[SSA]]**** [[CP0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004703 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4704
4705 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4706 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004707 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]****
4708 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SSA]]***
4709 // CK29-DAG: store [[SSA]]*** [[VAR00]], [[SSA]]**** [[CBP1]]
4710 // CK29-DAG: store [[SSA]]** [[VAR1:%.+]], [[SSA]]*** [[CP1]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004711 // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4712
4713 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4714 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004715 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SSA]]***
4716 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double***
4717 // CK29-DAG: store [[SSA]]** [[VAR1]], [[SSA]]*** [[CBP2]]
4718 // CK29-DAG: store double** [[VAR2:%.+]], double*** [[CP2]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004719 // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 0
4720
4721 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4722 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004723 // CK29-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double***
4724 // CK29-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double**
4725 // CK29-DAG: store double** [[VAR2]], double*** [[CBP3]]
4726 // CK29-DAG: store double* [[VAR3:%.+]], double** [[CP3]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004727 // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4728 // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4729
4730 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4731 #pragma omp target map(pr->p[:10])
4732 {
4733 pr->p++;
4734 }
4735
4736 // Region 02
4737 // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 5, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[MTYPE02]]{{.+}})
4738
4739 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4740 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4741
4742 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4743 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004744 // CK29-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [[SSB]]**
4745 // CK29-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [[SSA]]****
4746 // CK29-DAG: store [[SSB]]* [[VAR0:%.+]], [[SSB]]** [[CBP0]]
4747 // CK29-DAG: store [[SSA]]*** [[VAR00:%.+]], [[SSA]]**** [[CP0]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004748 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4749
4750 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4751 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004752 // CK29-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[SSA]]****
4753 // CK29-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[SSA]]***
4754 // CK29-DAG: store [[SSA]]*** [[VAR00]], [[SSA]]**** [[CBP1]]
4755 // CK29-DAG: store [[SSA]]** [[VAR1:%.+]], [[SSA]]*** [[CP1]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004756 // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4757
4758 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4759 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004760 // CK29-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to [[SSA]]***
4761 // CK29-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double****
4762 // CK29-DAG: store [[SSA]]** [[VAR1]], [[SSA]]*** [[CBP2]]
4763 // CK29-DAG: store double*** [[VAR2:%.+]], double**** [[CP2]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004764 // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4765
4766 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4767 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004768 // CK29-DAG: [[CBP3:%.+]] = bitcast i8** [[BP3]] to double****
4769 // CK29-DAG: [[CP3:%.+]] = bitcast i8** [[P3]] to double***
4770 // CK29-DAG: store double*** [[VAR2]], double**** [[CBP3]]
4771 // CK29-DAG: store double** [[VAR3:%.+]], double*** [[CP3]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004772 // CK29-DAG: [[VAR3]] = load double**, double*** [[VAR2]],
4773
4774 // CK29-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 4
4775 // CK29-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 4
Alexey Bataev1fdfdf72017-06-29 16:43:05 +00004776 // CK29-DAG: [[CBP4:%.+]] = bitcast i8** [[BP4]] to double***
4777 // CK29-DAG: [[CP4:%.+]] = bitcast i8** [[P4]] to double**
4778 // CK29-DAG: store double** [[VAR3]], double*** [[CBP4]]
4779 // CK29-DAG: store double* [[VAR4:%.+]], double** [[CP4]]
Samuel Antao03a3cec2016-07-27 22:52:16 +00004780 // CK29-DAG: [[VAR4]] = getelementptr inbounds double, double* [[VAR44:%.+]], i{{.+}} 0
4781 // CK29-DAG: [[VAR44]] = load double*, double**
4782
4783 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4784 #pragma omp target map(pr->pr[:10])
4785 {
4786 pr->pr++;
4787 }
4788 }
4789};
4790
4791void explicit_maps_member_pointer_references(SSA *sap) {
4792 double *d;
4793 SSA sa(d);
4794 SSB sb(sap);
4795 sb.foo();
4796}
4797#endif
Samuel Antao4af1b7b2015-12-02 17:44:43 +00004798#endif