]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/OpenMP/target_map_codegen.cpp
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / OpenMP / target_map_codegen.cpp
1 // expected-no-diagnostics
2 #ifndef HEADER
3 #define HEADER
4
5 ///
6 /// Implicit maps.
7 ///
8
9 ///==========================================================================///
10 // 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
16 #ifdef CK1
17
18 // CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
19 // Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
20 // CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
21
22 // CK1-LABEL: implicit_maps_integer
23 void 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
31   // CK1-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
32   // CK1-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
33   // CK1-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
34   // CK1-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
35   // 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 ///==========================================================================///
55 // 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
61 #ifdef CK2
62
63 // CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
64 // Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
65 // 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]
69
70 // CK2-LABEL: implicit_maps_reference
71 void implicit_maps_reference (int a, int *b){
72   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
78   // CK2-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
79   // CK2-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
80   // CK2-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
81   // CK2-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
82   // 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   }
91
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
98   // CK2-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
99   // CK2-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
100   // CK2-DAG: [[VALBP]] = bitcast i32* [[VAL:%.+]] to i8*
101   // CK2-DAG: [[VALP]] = bitcast i32* [[VAL]] to i8*
102   // 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   }
110 }
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
124 // 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
132 #endif
133 ///==========================================================================///
134 // 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
140 #ifdef CK3
141
142 // CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
143 // Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
144 // CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
145
146 // CK3-LABEL: implicit_maps_parameter
147 void 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
154   // CK3-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
155   // CK3-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
156   // CK3-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
157   // CK3-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
158   // 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 ///==========================================================================///
178 // 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
184 #ifdef CK4
185
186 // CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
187 // Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
188 // CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
189
190 // CK4-LABEL: implicit_maps_nested_integer
191 void 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
206     // CK4-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
207     // CK4-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
208     // CK4-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
209     // CK4-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
210     // 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 ///==========================================================================///
234 // 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
240 #ifdef CK5
241
242 // CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
243 // Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
244 // CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
245
246 // CK5-LABEL: implicit_maps_nested_integer_and_enum
247 void 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
260   // CK5-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
261   // CK5-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
262   // CK5-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
263   // CK5-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
264   // 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 ///==========================================================================///
285 // 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
291 #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]
294 // Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
295 // CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
296
297 // CK6-LABEL: implicit_maps_host_global
298 int Gi;
299 void 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
305   // CK6-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
306   // CK6-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
307   // CK6-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
308   // CK6-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
309   // 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 ///==========================================================================///
331 // 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
337 #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]
343 // 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]
347
348 // CK7-LABEL: implicit_maps_double
349 void 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
358   // CK7-64-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
359   // CK7-64-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
360   // CK7-64-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
361   // CK7-64-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
362   // 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
366   // CK7-32-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
367   // CK7-32-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
368   // CK7-32-DAG: [[VALBP]] = bitcast double* [[DECL:%.+]] to i8*
369   // CK7-32-DAG: [[VALP]] = bitcast double* [[DECL]] to i8*
370
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 ///==========================================================================///
393 // 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
399 #ifdef CK8
400
401 // CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
402 // Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
403 // CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
404
405 // CK8-LABEL: implicit_maps_float
406 void 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
414   // CK8-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
415   // CK8-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
416   // CK8-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
417   // CK8-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
418   // 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 ///==========================================================================///
437 // 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
443 #ifdef CK9
444
445 // CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
446 // Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
447 // CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 35]
448
449 // CK9-LABEL: implicit_maps_array
450 void 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
458   // CK9-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
459   // CK9-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
460   // CK9-DAG: [[VALBP]] = bitcast [2 x double]* [[DECL:%.+]] to i8*
461   // CK9-DAG: [[VALP]] = bitcast [2 x double]* [[DECL]] to i8*
462
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 ///==========================================================================///
478 // 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
484 #ifdef CK10
485
486 // 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]
489
490 // CK10-LABEL: implicit_maps_pointer
491 void 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
499   // CK10-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
500   // CK10-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
501   // CK10-DAG: [[VALBP]] = bitcast double* [[PTR:%.+]] to i8*
502   // CK10-DAG: [[VALP]] = bitcast double* [[PTR]] to i8*
503
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 ///==========================================================================///
520 // 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
526 #ifdef CK11
527
528 // CK11-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
529 // Map types: OMP_MAP_TO + OMP_MAP_IS_FIRST = 33
530 // CK11-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
531
532 // CK11-LABEL: implicit_maps_double_complex
533 void 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
541   // CK11-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
542   // CK11-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
543   // CK11-DAG: [[VALBP]] = bitcast { double, double }* [[PTR:%.+]] to i8*
544   // CK11-DAG: [[VALP]] = bitcast { double, double }* [[PTR]] to i8*
545
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 ///==========================================================================///
560 // 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
566 #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]
572 // 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]
576
577 // CK12-LABEL: implicit_maps_float_complex
578 void 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
587   // CK12-64-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
588   // CK12-64-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
589   // CK12-64-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
590   // CK12-64-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
591   // 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
595   // CK12-32-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
596   // CK12-32-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
597   // CK12-32-DAG: [[VALBP]] = bitcast { float, float }* [[DECL:%.+]] to i8*
598   // CK12-32-DAG: [[VALP]] = bitcast { float, float }* [[DECL]] to i8*
599
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 ///==========================================================================///
621 // 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
627 #ifdef CK13
628
629 // We don't have a constant map size for VLAs.
630 // Map types:
631 //  - 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]
635
636 // CK13-LABEL: implicit_maps_variable_length_array
637 void 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
648   // CK13-DAG: store i8* inttoptr (i[[sz]] 2 to i8*), i8** [[BP0]],
649   // CK13-DAG: store i8* inttoptr (i[[sz]] 2 to i8*), i8** [[P0]],
650   // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S0]],
651
652   // CK13-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
653   // CK13-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
654   // CK13-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1
655   // CK13-DAG: store i8* [[VALBP1:%.+]], i8** [[BP1]],
656   // CK13-DAG: store i8* [[VALP1:%.+]], i8** [[P1]],
657   // CK13-DAG: [[VALBP1]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
658   // CK13-DAG: [[VALP1]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
659   // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S1]],
660
661   // CK13-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
662   // CK13-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
663   // CK13-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2
664   // CK13-DAG: store i8* [[VALBP2:%.+]], i8** [[BP2]],
665   // CK13-DAG: store i8* [[VALP2:%.+]], i8** [[P2]],
666   // CK13-DAG: store i[[sz]] [[VALS2:%.+]], i[[sz]]* [[S2]],
667   // CK13-DAG: [[VALBP2]] = bitcast double* [[DECL:%.+]] to i8*
668   // CK13-DAG: [[VALP2]] = bitcast double* [[DECL]] to i8*
669   // CK13-DAG: [[VALS2]] = mul nuw i[[sz]] %{{.+}}, 8
670
671   // CK13: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]])
672   #pragma omp target
673   {
674     vla[1][3] += 1.0;
675   }
676 }
677
678 // CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]])
679 // CK13: [[ADDR0:%.+]] = alloca i[[sz]],
680 // CK13: [[ADDR1:%.+]] = alloca i[[sz]],
681 // CK13: [[ADDR2:%.+]] = alloca double*,
682 // CK13: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]],
683 // CK13: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]],
684 // CK13: store double* [[ARG]], double** [[ADDR2]],
685 // CK13: {{.+}} = load i[[sz]],  i[[sz]]* [[ADDR0]],
686 // CK13: {{.+}} = load i[[sz]],  i[[sz]]* [[ADDR1]],
687 // CK13: [[REF:%.+]] = load double*, double** [[ADDR2]],
688 // CK13: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}}
689 #endif
690 ///==========================================================================///
691 // 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
692 // 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
693 // 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
694 // 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
695 // 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
696 // 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
697 #ifdef CK14
698
699 // CK14-DAG: [[ST:%.+]] = type { i32, double }
700 // CK14-DAG: [[SIZES:@.+]] = {{.+}}constant [2 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}, i{{64|32}} 4]
701 // Map types:
702 // - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
703 // - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
704 // CK14-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
705
706 class SSS {
707 public:
708   int a;
709   double b;
710
711   void foo(int c) {
712     #pragma omp target
713     {
714       a += c;
715       b += (double)c;
716     }
717   }
718
719   SSS(int a, double b) : a(a), b(b) {}
720 };
721
722 // CK14-LABEL: implicit_maps_class
723 void implicit_maps_class (int a){
724   SSS sss(a, (double)a);
725
726   // CK14: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
727   // CK14-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
728   // CK14-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
729   // CK14-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
730
731   // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
732   // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
733   // CK14-DAG: store i8* [[VALBP0:%.+]], i8** [[BP0]],
734   // CK14-DAG: store i8* [[VALP0:%.+]], i8** [[P0]],
735   // CK14-DAG: [[VALBP0]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
736   // CK14-DAG: [[VALP0]] = bitcast [[ST]]* [[DECL]] to i8*
737
738   // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
739   // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
740   // CK14-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
741   // CK14-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
742   // CK14-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
743   // CK14-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
744   // CK14-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
745   // CK14-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
746   // CK14-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
747
748   // CK14: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
749   sss.foo(123);
750 }
751
752 // CK14: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
753 // CK14: [[ADDR0:%.+]] = alloca [[ST]]*,
754 // CK14: [[ADDR1:%.+]] = alloca i[[sz]],
755 // CK14: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
756 // CK14: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
757 // CK14: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
758 // CK14-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
759 // CK14-64: {{.+}} = load i32,  i32* [[CADDR1]],
760 // CK14-32: {{.+}} = load i32, i32* [[ADDR1]],
761 // CK14: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
762
763 #endif
764 ///==========================================================================///
765 // 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
766 // 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
767 // 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
768 // 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
769 // 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
770 // 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
771 #ifdef CK15
772
773 // CK15: [[ST:%.+]] = type { i32, double, i32* }
774 // CK15: [[SIZES:@.+]] = {{.+}}constant [2 x i[[sz:64|32]]] [i{{64|32}} {{24|16}}, i{{64|32}} 4]
775 // Map types:
776 // - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
777 // - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
778 // CK15: [[TYPES:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
779
780 // CK15: [[SIZES2:@.+]] = {{.+}}constant [2 x i[[sz]]] [i{{64|32}} {{24|16}}, i{{64|32}} 4]
781 // Map types:
782 // - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
783 // - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
784 // CK15: [[TYPES2:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
785
786 template<int x>
787 class SSST {
788 public:
789   int a;
790   double b;
791   int &r;
792
793   void foo(int c) {
794     #pragma omp target
795     {
796       a += c + x;
797       b += (double)(c + x);
798       r += x;
799     }
800   }
801   template<int y>
802   void bar(int c) {
803     #pragma omp target
804     {
805       a += c + x + y;
806       b += (double)(c + x + y);
807       r += x + y;
808     }
809   }
810
811   SSST(int a, double b, int &r) : a(a), b(b), r(r) {}
812 };
813
814 // CK15-LABEL: implicit_maps_templated_class
815 void implicit_maps_templated_class (int a){
816   SSST<123> ssst(a, (double)a, a);
817
818   // CK15: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
819   // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
820   // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
821   // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
822
823   // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
824   // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
825   // CK15-DAG: store i8* [[VALBP0:%.+]], i8** [[BP0]],
826   // CK15-DAG: store i8* [[VALP0:%.+]], i8** [[P0]],
827   // CK15-DAG: [[VALBP0]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
828   // CK15-DAG: [[VALP0]] = bitcast [[ST]]* [[DECL]] to i8*
829
830   // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
831   // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
832   // CK15-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
833   // CK15-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
834   // CK15-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
835   // CK15-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
836   // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
837   // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
838   // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
839
840   // CK15: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
841   ssst.foo(456);
842
843   // CK15: define {{.*}}void @{{.+}}bar{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
844   // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
845   // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
846   // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
847
848   // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
849   // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
850   // CK15-DAG: store i8* [[VALBP0:%.+]], i8** [[BP0]],
851   // CK15-DAG: store i8* [[VALP0:%.+]], i8** [[P0]],
852   // CK15-DAG: [[VALBP0]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
853   // CK15-DAG: [[VALP0]] = bitcast [[ST]]* [[DECL]] to i8*
854
855   // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
856   // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
857   // CK15-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
858   // CK15-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
859   // CK15-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
860   // CK15-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
861   // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
862   // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
863   // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
864
865   // CK15: call void [[KERNEL2:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
866   ssst.bar<210>(789);
867 }
868
869 // CK15: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
870 // CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
871 // CK15: [[ADDR1:%.+]] = alloca i[[sz]],
872 // CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
873 // CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
874 // CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
875 // CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
876 // CK15-64: {{.+}} = load i32,  i32* [[CADDR1]],
877 // CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
878 // CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
879
880 // CK15: define internal void [[KERNEL2]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
881 // CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
882 // CK15: [[ADDR1:%.+]] = alloca i[[sz]],
883 // CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
884 // CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
885 // CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
886 // CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
887 // CK15-64: {{.+}} = load i32,  i32* [[CADDR1]],
888 // CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
889 // CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
890
891 #endif
892 ///==========================================================================///
893 // 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
894 // 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
895 // 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
896 // 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
897 // 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
898 // 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
899 #ifdef CK16
900
901 // CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
902 // Map types:
903 // - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
904 // CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
905
906 template<int y>
907 int foo(int d) {
908   int res = d;
909   #pragma omp target
910   {
911     res += y;
912   }
913   return res;
914 }
915 // CK16-LABEL: implicit_maps_templated_function
916 void implicit_maps_templated_function (int a){
917   int i = a;
918
919   // CK16: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
920   // CK16-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
921   // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
922   // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
923
924   // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
925   // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
926   // CK16-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
927   // CK16-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
928   // CK16-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
929   // CK16-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
930   // CK16-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
931   // CK16-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
932   // CK16-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
933
934   // CK16: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
935   i = foo<543>(i);
936 }
937 // CK16: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
938 // CK16: [[ADDR:%.+]] = alloca i[[sz]],
939 // CK16: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
940 // CK16-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
941 // CK16-64: {{.+}} = load i32, i32* [[CADDR]],
942 // CK16-32: {{.+}} = load i32, i32* [[ADDR]],
943
944 #endif
945 ///==========================================================================///
946 // 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
947 // 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
948 // 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
949 // 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
950 // 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
951 // 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
952 #ifdef CK17
953
954 // CK17-DAG: [[ST:%.+]] = type { i32, double }
955 // CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}]
956 // Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
957 // CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 35]
958
959 class SSS {
960 public:
961   int a;
962   double b;
963 };
964
965 // CK17-LABEL: implicit_maps_struct
966 void implicit_maps_struct (int a){
967   SSS s = {a, (double)a};
968
969   // CK17-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
970   // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
971   // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
972   // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
973   // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
974   // CK17-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
975   // CK17-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
976   // CK17-DAG: [[VALBP]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
977   // CK17-DAG: [[VALP]] = bitcast [[ST]]* [[DECL]] to i8*
978
979   // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]])
980   #pragma omp target
981   {
982     s.a += 1;
983     s.b += 1.0;
984   }
985 }
986
987 // CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]])
988 // CK17: [[ADDR:%.+]] = alloca [[ST]]*,
989 // CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]],
990 // CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]],
991 // CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0
992 #endif
993 ///==========================================================================///
994 // 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
995 // 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
996 // 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
997 // 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
998 // 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
999 // 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
1000 #ifdef CK18
1001
1002 // CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
1003 // Map types:
1004 // - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
1005 // CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
1006
1007 template<typename T>
1008 int foo(T d) {
1009   #pragma omp target
1010   {
1011     d += (T)1;
1012   }
1013   return d;
1014 }
1015 // CK18-LABEL: implicit_maps_template_type_capture
1016 void implicit_maps_template_type_capture (int a){
1017   int i = a;
1018
1019   // CK18: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
1020   // CK18-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
1021   // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1022   // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1023
1024   // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1025   // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
1026   // CK18-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
1027   // CK18-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
1028   // CK18-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
1029   // CK18-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
1030   // CK18-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1031   // CK18-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1032   // CK18-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1033
1034   // CK18: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1035   i = foo(i);
1036 }
1037 // CK18: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1038 // CK18: [[ADDR:%.+]] = alloca i[[sz]],
1039 // CK18: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1040 // CK18-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1041 // CK18-64: {{.+}} = load i32, i32* [[CADDR]],
1042 // CK18-32: {{.+}} = load i32, i32* [[ADDR]],
1043
1044 #endif
1045 ///==========================================================================///
1046 // 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
1047 // 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
1048 // 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
1049 // 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
1050 // 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
1051 // 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
1052 #ifdef CK19
1053
1054 // CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
1055 // CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
1056
1057 // CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
1058 // CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
1059
1060 // CK19: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
1061 // CK19: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
1062
1063 // CK19: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
1064 // CK19: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1065
1066 // CK19: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
1067 // CK19: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
1068
1069 // CK19: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
1070 // CK19: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
1071
1072 // CK19: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1073
1074 // CK19: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
1075
1076 // CK19: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
1077 // CK19: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1078
1079 // CK19: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
1080 // CK19: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
1081
1082 // CK19: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
1083 // CK19: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1084
1085 // CK19: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
1086 // CK19: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
1087
1088 // CK19: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
1089 // CK19: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
1090
1091 // CK19: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
1092
1093 // CK19: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
1094
1095 // CK19: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
1096 // CK19: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
1097
1098 // CK19: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
1099
1100 // CK19: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
1101 // CK19: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 34]
1102
1103 // CK19: [[SIZE18:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
1104 // CK19: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
1105
1106 // CK19: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 32]
1107
1108 // CK19: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
1109 // CK19: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
1110
1111 // CK19: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
1112
1113 // CK19: [[SIZE22:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
1114 // CK19: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
1115
1116 // CK19: [[SIZE23:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
1117 // CK19: [[MTYPE23:@.+]] = private {{.*}}constant [1 x i32] [i32 39]
1118
1119 // CK19: [[SIZE24:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 480]
1120 // CK19: [[MTYPE24:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1121
1122 // CK19: [[SIZE25:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
1123 // CK19: [[MTYPE25:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1124
1125 // CK19: [[SIZE26:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 24]
1126 // CK19: [[MTYPE26:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1127
1128 // CK19: [[SIZE27:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
1129 // CK19: [[MTYPE27:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1130
1131 // CK19: [[SIZE28:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 16]
1132 // CK19: [[MTYPE28:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
1133
1134 // CK19: [[SIZE29:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
1135 // CK19: [[MTYPE29:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
1136
1137 // CK19: [[MTYPE30:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
1138
1139 // CK19: [[SIZE31:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 40]
1140 // CK19: [[MTYPE31:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
1141
1142 // CK19: [[SIZE32:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
1143 // CK19: [[MTYPE32:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1144
1145 // CK19: [[SIZE33:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
1146 // CK19: [[MTYPE33:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1147
1148 // CK19: [[SIZE34:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
1149 // CK19: [[MTYPE34:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1150
1151 // CK19: [[MTYPE35:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1152
1153 // CK19: [[SIZE36:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 208]
1154 // CK19: [[MTYPE36:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1155
1156 // CK19: [[MTYPE37:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
1157
1158 // CK19: [[MTYPE38:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
1159
1160 // CK19: [[MTYPE39:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
1161
1162 // CK19: [[MTYPE40:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
1163
1164 // CK19: [[SIZE41:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 208]
1165 // CK19: [[MTYPE41:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
1166
1167 // CK19: [[SIZE42:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 104]
1168 // CK19: [[MTYPE42:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
1169
1170 // CK19: [[MTYPE43:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
1171
1172 // CK19-LABEL: explicit_maps_single
1173 void explicit_maps_single (int ii){
1174   // Map of a scalar.
1175   int a = ii;
1176
1177   // Region 00
1178   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
1179   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1180   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1181
1182   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1183   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1184   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1185   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1186   // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
1187   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
1188
1189   // CK19: call void [[CALL00:@.+]](i32* {{[^,]+}})
1190   #pragma omp target map(alloc:a)
1191   {
1192     ++a;
1193   }
1194
1195   // Map of an array.
1196   int arra[100];
1197
1198   // Region 01
1199   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
1200   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1201   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1202
1203   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1204   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1205   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1206   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1207   // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1208   // CK19-DAG: [[CPVAL0]] = bitcast [100 x i32]* [[VAR0]] to i8*
1209
1210   // CK19: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
1211   #pragma omp target map(to:arra)
1212   {
1213     arra[50]++;
1214   }
1215
1216   // Region 02
1217   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
1218   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1219   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1220
1221   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1222   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1223   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1224   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1225   // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1226   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1227   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20
1228
1229   // CK19: call void [[CALL02:@.+]]([100 x i32]* {{[^,]+}})
1230   #pragma omp target map(from:arra[20:60])
1231   {
1232     arra[50]++;
1233   }
1234
1235   // Region 03
1236   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
1237   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1238   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1239
1240   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1241   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1242   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1243   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1244   // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1245   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1246   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1247
1248   // CK19: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
1249   #pragma omp target map(tofrom:arra[:60])
1250   {
1251     arra[50]++;
1252   }
1253
1254   // Region 04
1255   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
1256   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1257   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1258
1259   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1260   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1261   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1262   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1263   // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1264   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1265   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1266
1267   // CK19: call void [[CALL04:@.+]]([100 x i32]* {{[^,]+}})
1268   #pragma omp target map(alloc:arra[:])
1269   {
1270     arra[50]++;
1271   }
1272
1273   // Region 05
1274   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
1275   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1276   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1277
1278   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1279   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1280   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1281   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1282   // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1283   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1284   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 15
1285
1286   // CK19: call void [[CALL05:@.+]]([100 x i32]* {{[^,]+}})
1287   #pragma omp target map(to:arra[15])
1288   {
1289     arra[15]++;
1290   }
1291
1292   // Region 06
1293   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
1294   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1295   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1296   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1297
1298   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1299   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1300   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1301   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1302   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1303   // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1304   // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1305   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1306   // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1307   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1308
1309   // CK19: call void [[CALL06:@.+]]([100 x i32]* {{[^,]+}})
1310   #pragma omp target map(tofrom:arra[ii:ii+23])
1311   {
1312     arra[50]++;
1313   }
1314
1315   // Region 07
1316   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
1317   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1318   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1319   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1320
1321   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1322   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1323   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1324   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1325   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1326   // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1327   // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1328   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1329   // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1330   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1331
1332   // CK19: call void [[CALL07:@.+]]([100 x i32]* {{[^,]+}})
1333   #pragma omp target map(alloc:arra[:ii])
1334   {
1335     arra[50]++;
1336   }
1337
1338   // Region 08
1339   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
1340   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1341   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1342
1343   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1344   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1345   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1346   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1347   // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1348   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1349   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1350
1351   // CK19: call void [[CALL08:@.+]]([100 x i32]* {{[^,]+}})
1352   #pragma omp target map(tofrom:arra[ii])
1353   {
1354     arra[15]++;
1355   }
1356
1357   // Map of a pointer.
1358   int *pa;
1359
1360   // Region 09
1361   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
1362   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1363   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1364
1365   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1366   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1367   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1368   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1369   // CK19-DAG: [[CBPVAL0]] = bitcast i32** [[VAR0:%.+]] to i8*
1370   // CK19-DAG: [[CPVAL0]] = bitcast i32** [[VAR0]] to i8*
1371
1372   // CK19: call void [[CALL09:@.+]](i32** {{[^,]+}})
1373   #pragma omp target map(from:pa)
1374   {
1375     pa[50]++;
1376   }
1377
1378   // Region 10
1379   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
1380   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1381   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1382
1383   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1384   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1385   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1386   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1387   // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1388   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1389   // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1390   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 20
1391   // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1392
1393   // CK19: call void [[CALL10:@.+]](i32* {{[^,]+}})
1394   #pragma omp target map(tofrom:pa[20:60])
1395   {
1396     pa[50]++;
1397   }
1398
1399   // Region 11
1400   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
1401   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1402   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1403
1404   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1405   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1406   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1407   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1408   // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1409   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1410   // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1411   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1412   // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1413
1414   // CK19: call void [[CALL11:@.+]](i32* {{[^,]+}})
1415   #pragma omp target map(alloc:pa[:60])
1416   {
1417     pa[50]++;
1418   }
1419
1420   // Region 12
1421   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
1422   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1423   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1424
1425   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1426   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1427   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1428   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1429   // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1430   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1431   // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1432   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 15
1433   // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1434
1435   // CK19: call void [[CALL12:@.+]](i32* {{[^,]+}})
1436   #pragma omp target map(to:pa[15])
1437   {
1438     pa[15]++;
1439   }
1440
1441   // Region 13
1442   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
1443   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1444   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1445   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1446
1447   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1448   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1449   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1450   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1451   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1452   // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1453   // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1454   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1455   // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1456   // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1457   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1458   // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1459
1460   // CK19: call void [[CALL13:@.+]](i32* {{[^,]+}})
1461   #pragma omp target map(alloc:pa[ii-23:ii])
1462   {
1463     pa[50]++;
1464   }
1465
1466   // Region 14
1467   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
1468   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1469   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1470   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1471
1472   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1473   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1474   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1475   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1476   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1477   // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1478   // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1479   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1480   // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1481   // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1482   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1483   // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1484
1485   // CK19: call void [[CALL14:@.+]](i32* {{[^,]+}})
1486   #pragma omp target map(to:pa[:ii])
1487   {
1488     pa[50]++;
1489   }
1490
1491   // Region 15
1492   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
1493   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1494   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1495
1496   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1497   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1498   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1499   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1500   // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1501   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1502   // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1503   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1504   // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1505
1506   // CK19: call void [[CALL15:@.+]](i32* {{[^,]+}})
1507   #pragma omp target map(from:pa[ii+12])
1508   {
1509     pa[15]++;
1510   }
1511
1512   // Map of a variable-size array.
1513   int va[ii];
1514
1515   // Region 16
1516   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE16]]{{.+}})
1517   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1518   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1519   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1520
1521   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1522   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1523   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1524   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1525   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1526   // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
1527   // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1528   // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1529
1530   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1531   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1532   // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1533   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1534   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1535   // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
1536   // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1537   // CK19-DAG: [[CPVAL1]] = bitcast i32* [[VAR1]] to i8*
1538   // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1539
1540   // CK19: call void [[CALL16:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1541   #pragma omp target map(to:va)
1542   {
1543    va[50]++;
1544   }
1545
1546   // Region 17
1547   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
1548   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1549   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1550
1551   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1552   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1553   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1554   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1555   // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1556   // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1557
1558   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1559   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1560   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1561   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1562   // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1563   // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1564   // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 20
1565
1566   // CK19: call void [[CALL17:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1567   #pragma omp target map(from:va[20:60])
1568   {
1569    va[50]++;
1570   }
1571
1572   // Region 18
1573   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE18]]{{.+}})
1574   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1575   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1576
1577   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1578   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1579   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1580   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1581   // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1582   // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1583
1584   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1585   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1586   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1587   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1588   // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1589   // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1590   // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1591
1592   // CK19: call void [[CALL18:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1593   #pragma omp target map(tofrom:va[:60])
1594   {
1595    va[50]++;
1596   }
1597
1598   // Region 19
1599   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
1600   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1601   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1602   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1603
1604   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1605   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1606   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1607   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1608   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1609   // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
1610   // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1611   // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1612
1613   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1614   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1615   // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1616   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1617   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1618   // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
1619   // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1620   // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1621   // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1622   // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1623
1624   // CK19: call void [[CALL19:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1625   #pragma omp target map(alloc:va[:])
1626   {
1627    va[50]++;
1628   }
1629
1630   // Region 20
1631   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
1632   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1633   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1634
1635   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1636   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1637   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1638   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1639   // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1640   // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1641
1642   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1643   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1644   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1645   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1646   // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1647   // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1648   // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 15
1649
1650   // CK19: call void [[CALL20:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1651   #pragma omp target map(to:va[15])
1652   {
1653    va[15]++;
1654   }
1655
1656   // Region 21
1657   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
1658   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1659   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1660   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1661
1662   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1663   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1664   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1665   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1666   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1667   // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
1668   // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1669   // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1670
1671   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1672   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1673   // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1674   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1675   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1676   // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
1677   // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1678   // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1679   // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1680   // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1681
1682   // CK19: call void [[CALL21:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1683   #pragma omp target map(tofrom:va[ii:ii+23])
1684   {
1685    va[50]++;
1686   }
1687
1688   // Region 22
1689   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE22]]{{.+}})
1690   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1691   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1692
1693   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1694   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1695   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1696   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1697   // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1698   // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1699
1700   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1701   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1702   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1703   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1704   // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1705   // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1706   // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1707
1708   // CK19: call void [[CALL22:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1709   #pragma omp target map(tofrom:va[ii])
1710   {
1711    va[15]++;
1712   }
1713
1714   // Always.
1715   // Region 23
1716   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE23]]{{.+}})
1717   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1718   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1719
1720   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1721   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1722   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1723   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1724   // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
1725   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
1726
1727   // CK19: call void [[CALL23:@.+]](i32* {{[^,]+}})
1728   #pragma omp target map(always, tofrom: a)
1729   {
1730    a++;
1731   }
1732
1733   // Multidimensional arrays.
1734   int marr[4][5][6];
1735   int ***mptr;
1736
1737   // Region 24
1738   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE24]]{{.+}})
1739   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1740   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1741
1742   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1743   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1744   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1745   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1746   // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1747   // CK19-DAG: [[CPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0]] to i8*
1748
1749   // CK19: call void [[CALL24:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1750   #pragma omp target map(tofrom: marr)
1751   {
1752    marr[1][2][3]++;
1753   }
1754
1755   // Region 25
1756   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE25]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE25]]{{.+}})
1757   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1758   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1759
1760   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1761   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1762   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1763   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1764   // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1765   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1766   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 2
1767   // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1768   // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1769
1770   // CK19: call void [[CALL25:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1771   #pragma omp target map(tofrom: marr[1][2][2:4])
1772   {
1773    marr[1][2][3]++;
1774   }
1775
1776   // Region 26
1777   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE26]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE26]]{{.+}})
1778   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1779   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1780
1781   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1782   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1783   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1784   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1785   // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1786   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1787   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 0
1788   // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1789   // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1790
1791   // CK19: call void [[CALL26:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1792   #pragma omp target map(tofrom: marr[1][2][:])
1793   {
1794    marr[1][2][3]++;
1795   }
1796
1797   // Region 27
1798   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE27]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE27]]{{.+}})
1799   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1800   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1801
1802   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1803   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1804   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1805   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1806   // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1807   // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1808   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 3
1809   // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1810   // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1811
1812   // CK19: call void [[CALL27:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1813   #pragma omp target map(tofrom: marr[1][2][3])
1814   {
1815    marr[1][2][3]++;
1816   }
1817
1818   // Region 28
1819   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE28]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE28]]{{.+}})
1820   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1821   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1822
1823   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1824   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1825   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1826   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1827   // CK19-DAG: [[CBPVAL0]] = bitcast i32*** [[VAR0:%.+]] to i8*
1828   // CK19-DAG: [[CPVAL0]] = bitcast i32*** [[SEC0:%.+]] to i8*
1829   // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1830   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1831   // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1832
1833   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1834   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1835   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1836   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1837   // CK19-DAG: [[CBPVAL1]] = bitcast i32*** [[SEC0]] to i8*
1838   // CK19-DAG: [[CPVAL1]] = bitcast i32** [[SEC1:%.+]] to i8*
1839   // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1840   // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1841   // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1842   // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1843
1844   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1845   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1846   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1847   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1848   // CK19-DAG: [[CBPVAL2]] = bitcast i32** [[SEC1]] to i8*
1849   // CK19-DAG: [[CPVAL2]] = bitcast i32* [[SEC2:%.+]] to i8*
1850   // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 2
1851   // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1852   // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1853   // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1854   // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1855   // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1856
1857   // CK19: call void [[CALL28:@.+]](i32*** {{[^,]+}})
1858   #pragma omp target map(tofrom: mptr[1][2][2:4])
1859   {
1860     mptr[1][2][3]++;
1861   }
1862
1863   // Region 29
1864   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE29]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE29]]{{.+}})
1865   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1866   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1867
1868   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1869   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1870   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1871   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1872   // CK19-DAG: [[CBPVAL0]] = bitcast i32*** [[VAR0:%.+]] to i8*
1873   // CK19-DAG: [[CPVAL0]] = bitcast i32*** [[SEC0:%.+]] to i8*
1874   // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1875   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1876   // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1877
1878   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1879   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1880   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1881   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1882   // CK19-DAG: [[CBPVAL1]] = bitcast i32*** [[SEC0]] to i8*
1883   // CK19-DAG: [[CPVAL1]] = bitcast i32** [[SEC1:%.+]] to i8*
1884   // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1885   // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1886   // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1887   // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1888
1889   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1890   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1891   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1892   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1893   // CK19-DAG: [[CBPVAL2]] = bitcast i32** [[SEC1]] to i8*
1894   // CK19-DAG: [[CPVAL2]] = bitcast i32* [[SEC2:%.+]] to i8*
1895   // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 3
1896   // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1897   // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1898   // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1899   // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1900   // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1901
1902   // CK19: call void [[CALL29:@.+]](i32*** {{[^,]+}})
1903   #pragma omp target map(tofrom: mptr[1][2][3])
1904   {
1905     mptr[1][2][3]++;
1906   }
1907
1908   // Multidimensional VLA.
1909   double mva[23][ii][ii+5];
1910
1911   // Region 30
1912   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE30]]{{.+}})
1913   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1914   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1915   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1916   //
1917   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1918   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1919   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1920   // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[BP0]]
1921   // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[P0]]
1922   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
1923   //
1924   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1925   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1926   // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1927   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1928   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1929   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
1930   // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
1931   // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
1932   // CK19-64-DAG: [[VAR1]] = zext i32 %{{[^,]+}} to i64
1933   // CK19-64-DAG: [[VAR11]] = zext i32 %{{[^,]+}} to i64
1934   //
1935   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1936   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1937   // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
1938   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1939   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1940   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S2]]
1941   // CK19-DAG: [[CBPVAL2]] = inttoptr i[[Z]] [[VAR2:%.+]] to i8*
1942   // CK19-DAG: [[CPVAL2]] = inttoptr i[[Z]] [[VAR22:%.+]] to i8*
1943   // CK19-64-DAG: [[VAR2]] = zext i32 %{{[^,]+}} to i64
1944   // CK19-64-DAG: [[VAR22]] = zext i32 %{{[^,]+}} to i64
1945   //
1946   // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1947   // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
1948   // CK19-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
1949   // CK19-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
1950   // CK19-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
1951   // CK19-DAG: store i[[Z]] [[CSVAL3:%[^,]+]], i[[Z]]* [[S3]]
1952   // CK19-DAG: [[CBPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
1953   // CK19-DAG: [[CPVAL3]] = bitcast double* [[VAR3]] to i8*
1954   // CK19-DAG: [[CSVAL3]] = mul nuw i[[Z]] %{{[^,]+}}, {{8|4}}
1955
1956   // CK19: call void [[CALL30:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
1957   #pragma omp target map(tofrom: mva)
1958   {
1959     mva[1][2][3]++;
1960   }
1961
1962   // Region 31
1963   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE31]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE31]]{{.+}})
1964   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1965   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1966   //
1967   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1968   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1969   // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[BP0]]
1970   // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[P0]]
1971   //
1972   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1973   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1974   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1975   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1976   // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
1977   // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
1978   //
1979   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1980   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1981   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1982   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1983   // CK19-DAG: [[CBPVAL2]] = inttoptr i[[Z]] [[VAR2:%.+]] to i8*
1984   // CK19-DAG: [[CPVAL2]] = inttoptr i[[Z]] [[VAR22:%.+]] to i8*
1985   //
1986   // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1987   // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
1988   // CK19-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
1989   // CK19-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
1990   // CK19-DAG: [[CBPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
1991   // CK19-DAG: [[CPVAL3]] = bitcast double* [[SEC3:%.+]] to i8*
1992   // CK19-DAG: [[SEC3]] = getelementptr {{.*}}double* [[SEC33:%.+]], i[[Z]] 0
1993   // CK19-DAG: [[SEC33]] = getelementptr {{.*}}double* [[SEC333:%.+]], i[[Z]] [[IDX3:%.+]]
1994   // CK19-DAG: [[IDX3]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}}
1995   // CK19-DAG: [[SEC333]] = getelementptr {{.*}}double* [[VAR3]], i[[Z]] [[IDX33:%.+]]
1996   // CK19-DAG: [[IDX33]] = mul nsw i[[Z]] 1, %{{[^,]+}}
1997
1998   // CK19: call void [[CALL31:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
1999   #pragma omp target map(tofrom: mva[1][ii-2][:5])
2000   {
2001     mva[1][2][3]++;
2002   }
2003
2004   // Multidimensional array sections.
2005   double marras[11][12][13];
2006   double mvlaas[11][ii][13];
2007   double ***mptras;
2008
2009   // Region 32
2010   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE32]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE32]]{{.+}})
2011   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2012   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2013
2014   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2015   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2016   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2017   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2018   // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2019   // CK19-DAG: [[CPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0]] to i8*
2020
2021   // CK19: call void [[CALL32:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2022   #pragma omp target map(marras)
2023   {
2024     marras[1][2][3]++;
2025   }
2026
2027   // Region 33
2028   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE33]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE33]]{{.+}})
2029   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2030   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2031
2032   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2033   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2034   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2035   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2036   // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2037   // CK19-DAG: [[CPVAL0]] = bitcast [12 x [13 x double]]* [[SEC0:%.+]] to i8*
2038   // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2039
2040   // CK19: call void [[CALL33:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2041   #pragma omp target map(marras[:])
2042   {
2043     marras[1][2][3]++;
2044   }
2045
2046   // Region 34
2047   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE34]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE34]]{{.+}})
2048   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2049   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2050
2051   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2052   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2053   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2054   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2055   // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2056   // CK19-DAG: [[CPVAL0]] = bitcast [12 x [13 x double]]* [[SEC0:%.+]] to i8*
2057   // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2058
2059   // CK19: call void [[CALL34:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2060   #pragma omp target map(marras[:][:][:])
2061   {
2062     marras[1][2][3]++;
2063   }
2064
2065   // Region 35
2066   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE35]]{{.+}})
2067   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2068   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2069   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2070   //
2071   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2072   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2073   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2074
2075   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2076   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2077   // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
2078   // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2079   // CK19-DAG: [[CPVAL0]] = bitcast [13 x double]* [[SEC0:%.+]] to i8*
2080   // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2081   // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2082   // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2083
2084   // CK19: call void [[CALL35:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2085   #pragma omp target map(marras[1][:ii][:])
2086   {
2087     marras[1][2][3]++;
2088   }
2089
2090   // Region 36
2091   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE36]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE36]]{{.+}})
2092   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2093   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2094
2095   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2096   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2097   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2098   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2099   // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2100   // CK19-DAG: [[CPVAL0]] = bitcast [13 x double]* [[SEC0:%.+]] to i8*
2101   // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i{{.+}} 0
2102   // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 0
2103   // CK19-DAG: [[SEC000]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2104
2105   // CK19: call void [[CALL36:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2106   #pragma omp target map(marras[:1][:2][:13])
2107   {
2108     marras[1][2][3]++;
2109   }
2110
2111   // Region 37
2112   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE37]]{{.+}})
2113   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2114   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2115   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2116   //
2117   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2118   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2119   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2120   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2121   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2122   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2123   //
2124   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2125   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2126   // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2127   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2128   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2129   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2130   // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2131   // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2132   //
2133   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2134   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2135   // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2136   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2137   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2138   // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2139   // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2140   // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[VAR2]] to i8*
2141   // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2142
2143   // CK19: call void [[CALL37:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2144   #pragma omp target map(mvlaas)
2145   {
2146     mvlaas[1][2][3]++;
2147   }
2148
2149   // Region 38
2150   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE38]]{{.+}})
2151   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2152   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2153   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2154   //
2155   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2156   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2157   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2158   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2159   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2160   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2161   //
2162   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2163   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2164   // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2165   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2166   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2167   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2168   // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2169   // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2170   //
2171   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2172   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2173   // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2174   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2175   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2176   // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2177   // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2178   // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2179   // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2180   // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2181   // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2182
2183   // CK19: call void [[CALL38:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2184   #pragma omp target map(mvlaas[:])
2185   {
2186     mvlaas[1][2][3]++;
2187   }
2188
2189   // Region 39
2190   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE39]]{{.+}})
2191   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2192   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2193   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2194   //
2195   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2196   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2197   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2198   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2199   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2200   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2201   //
2202   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2203   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2204   // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2205   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2206   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2207   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2208   // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2209   // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2210   //
2211   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2212   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2213   // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2214   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2215   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2216   // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2217   // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2218   // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2219   // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2220   // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2221   // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2222
2223   // CK19: call void [[CALL39:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2224   #pragma omp target map(mvlaas[:][:][:])
2225   {
2226     mvlaas[1][2][3]++;
2227   }
2228
2229   // Region 40
2230   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE40]]{{.+}})
2231   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2232   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2233   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2234   //
2235   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2236   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2237   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2238   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2239   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2240   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2241   //
2242   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2243   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2244   // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2245   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2246   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2247   // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2248   // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2249   // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2250   //
2251   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2252   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2253   // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2254   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2255   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2256   // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2257   // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2258   // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2259   // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2260   // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2261   // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2262
2263   // CK19: call void [[CALL40:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2264   #pragma omp target map(mvlaas[1][:ii][:])
2265   {
2266     mvlaas[1][2][3]++;
2267   }
2268
2269   // Region 41
2270   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE41]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE41]]{{.+}})
2271   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2272   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2273   //
2274   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2275   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2276   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2277   // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2278   //
2279   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2280   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2281   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2282   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2283   // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2284   // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2285   //
2286   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2287   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2288   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2289   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2290   // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2291   // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2292   // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2293   // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2294   // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2295
2296   // CK19: call void [[CALL41:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2297   #pragma omp target map(mvlaas[:1][:2][:13])
2298   {
2299     mvlaas[1][2][3]++;
2300   }
2301
2302   // Region 42
2303   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE42]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE42]]{{.+}})
2304   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2305   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2306
2307   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2308   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2309   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2310   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2311   // CK19-DAG: [[CBPVAL0]] = bitcast double*** [[VAR0:%.+]] to i8*
2312   // CK19-DAG: [[CPVAL0]] = bitcast double*** [[SEC0:%.+]] to i8*
2313   // CK19-DAG: [[VAR0]] = load double***, double**** [[PTR:%[^,]+]],
2314   // CK19-DAG: [[SEC0]] = getelementptr {{.*}}double*** [[SEC00:[^,]+]], i{{.+}} 0
2315   // CK19-DAG: [[SEC00]] = load double***, double**** [[PTR]],
2316
2317   // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2318   // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2319   // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2320   // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2321   // CK19-DAG: [[CBPVAL1]] = bitcast double*** [[SEC0]] to i8*
2322   // CK19-DAG: [[CPVAL1]] = bitcast double** [[SEC1:%.+]] to i8*
2323   // CK19-DAG: [[SEC1]] = getelementptr {{.*}}double** [[SEC11:[^,]+]], i{{.+}} 2
2324   // CK19-DAG: [[SEC11]] = load double**, double*** [[SEC111:%[^,]+]],
2325   // CK19-DAG: [[SEC111]] = getelementptr {{.*}}double*** [[SEC1111:[^,]+]], i{{.+}} 0
2326   // CK19-DAG: [[SEC1111]] = load double***, double**** [[PTR]],
2327
2328   // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2329   // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2330   // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2331   // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2332   // CK19-DAG: [[CBPVAL2]] = bitcast double** [[SEC1]] to i8*
2333   // CK19-DAG: [[CPVAL2]] = bitcast double* [[SEC2:%.+]] to i8*
2334   // CK19-DAG: [[SEC2]] = getelementptr {{.*}}double* [[SEC22:[^,]+]], i{{.+}} 0
2335   // CK19-DAG: [[SEC22]] = load double*, double** [[SEC222:%[^,]+]],
2336   // CK19-DAG: [[SEC222]] = getelementptr {{.*}}double** [[SEC2222:[^,]+]], i{{.+}} 2
2337   // CK19-DAG: [[SEC2222]] = load double**, double*** [[SEC22222:%[^,]+]],
2338   // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}double*** [[SEC222222:[^,]+]], i{{.+}} 0
2339   // CK19-DAG: [[SEC222222]] = load double***, double**** [[PTR]],
2340
2341   // CK19: call void [[CALL42:@.+]](double*** {{[^,]+}})
2342   #pragma omp target map(mptras[:1][2][:13])
2343   {
2344     mptras[1][2][3]++;
2345   }
2346
2347   // Region 43 - the memory is not contiguous for this map - will map the whole last dimension.
2348   // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE43]]{{.+}})
2349   // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2350   // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2351   // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2352   //
2353   // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2354   // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2355   // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2356
2357   // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2358   // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2359   // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
2360   // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2361   // CK19-DAG: [[CPVAL0]] = bitcast [13 x double]* [[SEC0:%.+]] to i8*
2362   // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2363   // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2364   // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2365
2366   // CK19: call void [[CALL43:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2367   #pragma omp target map(marras[1][:ii][1:])
2368   {
2369     marras[1][2][3]++;
2370   }
2371
2372 }
2373
2374 // CK19: define {{.+}}[[CALL00]]
2375 // CK19: define {{.+}}[[CALL01]]
2376 // CK19: define {{.+}}[[CALL02]]
2377 // CK19: define {{.+}}[[CALL03]]
2378 // CK19: define {{.+}}[[CALL04]]
2379 // CK19: define {{.+}}[[CALL05]]
2380 // CK19: define {{.+}}[[CALL06]]
2381 // CK19: define {{.+}}[[CALL07]]
2382 // CK19: define {{.+}}[[CALL08]]
2383 // CK19: define {{.+}}[[CALL09]]
2384 // CK19: define {{.+}}[[CALL10]]
2385 // CK19: define {{.+}}[[CALL11]]
2386 // CK19: define {{.+}}[[CALL12]]
2387 // CK19: define {{.+}}[[CALL13]]
2388 // CK19: define {{.+}}[[CALL14]]
2389 // CK19: define {{.+}}[[CALL15]]
2390 // CK19: define {{.+}}[[CALL16]]
2391 // CK19: define {{.+}}[[CALL17]]
2392 // CK19: define {{.+}}[[CALL18]]
2393 // CK19: define {{.+}}[[CALL19]]
2394 // CK19: define {{.+}}[[CALL20]]
2395 // CK19: define {{.+}}[[CALL21]]
2396 // CK19: define {{.+}}[[CALL22]]
2397 // CK19: define {{.+}}[[CALL23]]
2398 // CK19: define {{.+}}[[CALL24]]
2399 // CK19: define {{.+}}[[CALL25]]
2400 // CK19: define {{.+}}[[CALL26]]
2401 // CK19: define {{.+}}[[CALL27]]
2402 // CK19: define {{.+}}[[CALL28]]
2403 // CK19: define {{.+}}[[CALL29]]
2404 // CK19: define {{.+}}[[CALL30]]
2405 // CK19: define {{.+}}[[CALL31]]
2406 // CK19: define {{.+}}[[CALL32]]
2407 // CK19: define {{.+}}[[CALL33]]
2408 // CK19: define {{.+}}[[CALL34]]
2409 // CK19: define {{.+}}[[CALL35]]
2410 // CK19: define {{.+}}[[CALL36]]
2411 // CK19: define {{.+}}[[CALL37]]
2412 // CK19: define {{.+}}[[CALL38]]
2413 // CK19: define {{.+}}[[CALL39]]
2414 // CK19: define {{.+}}[[CALL40]]
2415 // CK19: define {{.+}}[[CALL41]]
2416 // CK19: define {{.+}}[[CALL42]]
2417 // CK19: define {{.+}}[[CALL43]]
2418
2419 #endif
2420 ///==========================================================================///
2421 // 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
2422 // 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
2423 // 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
2424 // 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
2425 // 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
2426 // 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
2427 #ifdef CK20
2428
2429 // CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
2430 // CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
2431
2432 // CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
2433 // CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
2434
2435 // CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
2436 // CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
2437
2438 // CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 12]
2439 // CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
2440
2441 // CK20-LABEL: explicit_maps_references_and_function_args
2442 void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){
2443
2444   int &aa = a;
2445   float &bb = b;
2446   int (&cc)[10] = c;
2447   float *&dd = d;
2448
2449   // Region 00
2450   // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2451   // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2452   // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2453
2454   // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2455   // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2456   // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2457   // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2458   // CK20-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
2459   // CK20-DAG: [[CPVAL0]] = bitcast i32* [[RVAR00:%.+]] to i8*
2460   // CK20-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2461   // CK20-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2462
2463   // CK20: call void [[CALL00:@.+]](i32* {{[^,]+}})
2464   #pragma omp target map(to:aa)
2465   {
2466     aa += 1;
2467   }
2468
2469   // Region 01
2470   // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2471   // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2472   // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2473
2474   // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2475   // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2476   // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2477   // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2478   // CK20-DAG: [[CBPVAL0]] = bitcast [10 x i32]* [[RVAR0:%.+]] to i8*
2479   // CK20-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2480   // CK20-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0
2481   // CK20-DAG: [[RVAR0]] = load [10 x i32]*, [10 x i32]** [[VAR0:%[^,]+]]
2482   // CK20-DAG: [[RVAR00]] = load [10 x i32]*, [10 x i32]** [[VAR0]]
2483
2484   // CK20: call void [[CALL01:@.+]]([10 x i32]* {{[^,]+}})
2485   #pragma omp target map(to:cc[:5])
2486   {
2487     cc[3] += 1;
2488   }
2489
2490   // Region 02
2491   // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2492   // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2493   // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2494
2495   // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2496   // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2497   // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2498   // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2499   // CK20-DAG: [[CBPVAL0]] = bitcast float* [[VAR0:%.+]] to i8*
2500   // CK20-DAG: [[CPVAL0]] = bitcast float* [[VAR0]] to i8*
2501
2502   // CK20: call void [[CALL02:@.+]](float* {{[^,]+}})
2503   #pragma omp target map(from:b)
2504   {
2505     b += 1.0f;
2506   }
2507
2508   // Region 03
2509   // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2510   // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2511   // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2512
2513   // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2514   // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2515   // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2516   // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2517   // CK20-DAG: [[CBPVAL0]] = bitcast float* [[RVAR0:%.+]] to i8*
2518   // CK20-DAG: [[CPVAL0]] = bitcast float* [[SEC0:%.+]] to i8*
2519   // CK20-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
2520   // CK20-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
2521   // CK20-DAG: [[RVAR00]] = load float*, float** [[VAR0]]
2522
2523   // CK20: call void [[CALL03:@.+]](float* {{[^,]+}})
2524   #pragma omp target map(from:d[2:3])
2525   {
2526     d[2] += 1.0f;
2527   }
2528 }
2529
2530 // CK20: define {{.+}}[[CALL00]]
2531 // CK20: define {{.+}}[[CALL01]]
2532 // CK20: define {{.+}}[[CALL02]]
2533 // CK20: define {{.+}}[[CALL03]]
2534
2535 #endif
2536 ///==========================================================================///
2537 // 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
2538 // 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
2539 // 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
2540 // 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
2541 // 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
2542 // 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
2543 #ifdef CK21
2544 // CK21: [[ST:%.+]] = type { i32, i32, float* }
2545
2546 // CK21: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
2547 // CK21: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2548
2549 // CK21: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
2550 // CK21: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2551
2552 // CK21: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 500]
2553 // CK21: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 34, i32 18]
2554
2555 // CK21: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
2556 // CK21: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
2557
2558 // CK21: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
2559 // CK21: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
2560
2561 // CK21: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] 4, i[[Z]] 4]
2562 // CK21: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 3]
2563
2564 // CK21-LABEL: explicit_maps_template_args_and_members
2565
2566 template <int X, typename T>
2567 struct CC {
2568   T A;
2569   int A2;
2570   float *B;
2571
2572   int foo(T arg) {
2573     float la[X];
2574     T *lb;
2575
2576     // Region 00
2577     // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2578     // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2579     // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2580
2581     // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2582     // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2583     // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2584     // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2585     // CK21-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
2586     // CK21-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2587     // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
2588
2589     // CK21: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
2590     #pragma omp target map(A)
2591     {
2592       A += 1;
2593     }
2594     
2595     // Region 01
2596     // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2597     // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2598     // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2599
2600     // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2601     // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2602     // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2603     // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2604     // CK21-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
2605     // CK21-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2606     // CK21-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2607     // CK21-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
2608     // CK21-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2609
2610     // CK21: call void [[CALL01:@.+]](i32* {{[^,]+}})
2611     #pragma omp target map(lb[:X])
2612     {
2613       lb[4] += 1;
2614     }
2615     
2616     // Region 02
2617     // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
2618     // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2619     // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2620
2621     // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2622     // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2623     // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2624     // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2625     // CK21-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
2626     // CK21-DAG: [[CPVAL0]] = bitcast float** [[SEC0:%.+]] to i8*
2627     // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2628     
2629     // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2630     // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2631     // CK21-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2632     // CK21-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2633     // CK21-DAG: [[CBPVAL1]] = bitcast float** [[SEC0]] to i8*
2634     // CK21-DAG: [[CPVAL1]] = bitcast float* [[SEC1:%.+]] to i8*
2635     // CK21-DAG: [[SEC1]] = getelementptr {{.*}}float* [[RVAR1:%[^,]+]], i{{.+}} 123
2636     // CK21-DAG: [[RVAR1]] = load float*, float** [[SEC1_:%[^,]+]]
2637     // CK21-DAG: [[SEC1_]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2638
2639     // CK21: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}})
2640     #pragma omp target map(from:B[X:X+2])
2641     {
2642       B[2] += 1.0f;
2643     }
2644     
2645     // Region 03
2646     // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2647     // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2648     // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2649
2650     // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2651     // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2652     // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2653     // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2654     // CK21-DAG: [[CBPVAL0]] = bitcast [123 x float]* [[VAR0:%.+]] to i8*
2655     // CK21-DAG: [[CPVAL0]] = bitcast [123 x float]* [[VAR0]] to i8*
2656
2657     // CK21: call void [[CALL03:@.+]]([123 x float]* {{[^,]+}})
2658     #pragma omp target map(from:la)
2659     {
2660       la[3] += 1.0f;
2661     }
2662     
2663     // Region 04
2664     // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2665     // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2666     // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2667
2668     // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2669     // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2670     // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2671     // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2672     // CK21-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
2673     // CK21-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
2674
2675     // CK21: call void [[CALL04:@.+]](i32* {{[^,]+}})
2676     #pragma omp target map(from:arg)
2677     {
2678       arg +=1;
2679     }
2680     
2681     // Make sure the extra flag is passed to the second map.
2682     // Region 05
2683     // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
2684     // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2685     // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2686
2687     // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2688     // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2689     // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2690     // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2691     // CK21-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
2692     // CK21-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2693     // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2694
2695     // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2696     // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2697     // CK21-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2698     // CK21-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2699     // CK21-DAG: [[CBPVAL1]] = bitcast [[ST]]* [[VAR1:%.+]] to i8*
2700     // CK21-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
2701     // CK21-DAG: [[SEC1]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2702
2703     // CK21: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2704     #pragma omp target map(A, A2)
2705     {
2706       A += 1;
2707       A2 += 1;
2708     }
2709     return A;
2710   }
2711 };
2712
2713 int explicit_maps_template_args_and_members(int a){
2714   CC<123,int> c;
2715   return c.foo(a);
2716 }
2717
2718 // CK21: define {{.+}}[[CALL00]]
2719 // CK21: define {{.+}}[[CALL01]]
2720 // CK21: define {{.+}}[[CALL02]]
2721 // CK21: define {{.+}}[[CALL03]]
2722 // CK21: define {{.+}}[[CALL04]]
2723 // CK21: define {{.+}}[[CALL05]]
2724 #endif
2725 ///==========================================================================///
2726 // 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
2727 // 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
2728 // 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
2729 // 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
2730 // 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
2731 // 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
2732 #ifdef CK22
2733
2734 // CK22-DAG: [[ST:%.+]] = type { float }
2735 // CK22-DAG: [[STT:%.+]] = type { i32 }
2736
2737 // CK22: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
2738 // CK22: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2739
2740 // CK22: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
2741 // CK22: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2742
2743 // CK22: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
2744 // CK22: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2745
2746 // CK22: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
2747 // CK22: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2748
2749 // CK22: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
2750 // CK22: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2751
2752 // CK22: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
2753 // CK22: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2754
2755 // CK22: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
2756 // CK22: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2757
2758 // CK22: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
2759 // CK22: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2760
2761 // CK22: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
2762 // CK22: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2763
2764 // CK22: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
2765 // CK22: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2766
2767 // CK22: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
2768 // CK22: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2769
2770 // CK22: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
2771 // CK22: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2772
2773 // CK22: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
2774 // CK22: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2775
2776 // CK22: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
2777 // CK22: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2778
2779 // CK22: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
2780 // CK22: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
2781
2782 int a;
2783 int c[100];
2784 int *d;
2785
2786 struct ST {
2787   float fa;
2788 };
2789
2790 ST sa ;
2791 ST sc[100];
2792 ST *sd;
2793
2794 template<typename T>
2795 struct STT {
2796   T fa;
2797 };
2798
2799 STT<int> sta ;
2800 STT<int> stc[100];
2801 STT<int> *std;
2802
2803 // CK22-LABEL: explicit_maps_globals
2804 int explicit_maps_globals(void){
2805   // Region 00
2806   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2807   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2808   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2809
2810   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2811   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2812   // CK22-DAG: store i8* bitcast (i32* @a to i8*), i8** [[BP0]]
2813   // CK22-DAG: store i8* bitcast (i32* @a to i8*), i8** [[P0]]
2814
2815   // CK22: call void [[CALL00:@.+]](i32* {{[^,]+}})
2816   #pragma omp target map(a)
2817   { a+=1; }
2818   
2819   // Region 01
2820   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2821   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2822   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2823
2824   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2825   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2826   // CK22-DAG: store i8* bitcast ([100 x i32]* @c to i8*), i8** [[BP0]]
2827   // CK22-DAG: store i8* bitcast ([100 x i32]* @c to i8*), i8** [[P0]]
2828
2829   // CK22: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
2830   #pragma omp target map(c)
2831   { c[3]+=1; }
2832   
2833   // Region 02
2834   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2835   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2836   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2837
2838   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2839   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2840   // CK22-DAG: store i8* bitcast (i32** @d to i8*), i8** [[BP0]]
2841   // CK22-DAG: store i8* bitcast (i32** @d to i8*), i8** [[P0]]
2842
2843   // CK22: call void [[CALL02:@.+]](i32** {{[^,]+}})
2844   #pragma omp target map(d)
2845   { d[3]+=1; }
2846     
2847   // Region 03
2848   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2849   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2850   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2851
2852   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2853   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2854   // CK22-DAG: store i8* bitcast ([100 x i32]* @c to i8*), i8** [[BP0]]
2855   // CK22-DAG: store i8* bitcast (i32* getelementptr inbounds ([100 x i32], [100 x i32]* @c, i{{.+}} 0, i{{.+}} 1) to i8*), i8** [[P0]]
2856
2857   // CK22: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
2858   #pragma omp target map(c[1:4])
2859   { c[3]+=1; }
2860   
2861   // Region 04
2862   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2863   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2864   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2865
2866   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2867   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2868   // CK22-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2869   // CK22-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2870   // CK22-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
2871   // CK22-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2872   // CK22-DAG: [[RVAR0]] = load i32*, i32** @d
2873   // CK22-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 2
2874   // CK22-DAG: [[RVAR00]] = load i32*, i32** @d
2875
2876   // CK22: call void [[CALL04:@.+]](i32* {{[^,]+}})
2877   #pragma omp target map(d[2:5])
2878   { d[3]+=1; }
2879   
2880   // Region 05
2881   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
2882   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2883   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2884
2885   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2886   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2887   // CK22-DAG: store i8* bitcast ([[ST]]* @sa to i8*), i8** [[BP0]]
2888   // CK22-DAG: store i8* bitcast ([[ST]]* @sa to i8*), i8** [[P0]]
2889
2890   // CK22: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2891   #pragma omp target map(sa)
2892   { sa.fa+=1; }
2893   
2894   // Region 06
2895   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
2896   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2897   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2898
2899   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2900   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2901   // CK22-DAG: store i8* bitcast ([100 x [[ST]]]* @sc to i8*), i8** [[BP0]]
2902   // CK22-DAG: store i8* bitcast ([100 x [[ST]]]* @sc to i8*), i8** [[P0]]
2903
2904   // CK22: call void [[CALL06:@.+]]([100 x [[ST]]]* {{[^,]+}})
2905   #pragma omp target map(sc)
2906   { sc[3].fa+=1; }
2907   
2908   // Region 07
2909   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
2910   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2911   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2912
2913   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2914   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2915   // CK22-DAG: store i8* bitcast ([[ST]]** @sd to i8*), i8** [[BP0]]
2916   // CK22-DAG: store i8* bitcast ([[ST]]** @sd to i8*), i8** [[P0]]
2917
2918   // CK22: call void [[CALL07:@.+]]([[ST]]** {{[^,]+}})
2919   #pragma omp target map(sd)
2920   { sd[3].fa+=1; }
2921   
2922   // Region 08
2923   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
2924   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2925   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2926
2927   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2928   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2929   // CK22-DAG: store i8* bitcast ([100 x [[ST]]]* @sc to i8*), i8** [[BP0]]
2930   // CK22-DAG: store i8* bitcast ([[ST]]* getelementptr inbounds ([100 x [[ST]]], [100 x [[ST]]]* @sc, i{{.+}} 0, i{{.+}} 1) to i8*), i8** [[P0]]
2931
2932   // CK22: call void [[CALL08:@.+]]([100 x [[ST]]]* {{[^,]+}})
2933   #pragma omp target map(sc[1:4])
2934   { sc[3].fa+=1; }
2935   
2936   // Region 09
2937   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
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
2943   // CK22-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2944   // CK22-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2945   // CK22-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[RVAR0:%.+]] to i8*
2946   // CK22-DAG: [[CPVAL0]] = bitcast [[ST]]* [[SEC0:%.+]] to i8*
2947   // CK22-DAG: [[RVAR0]] = load [[ST]]*, [[ST]]** @sd
2948   // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[RVAR00:%.+]], i{{.+}} 2
2949   // CK22-DAG: [[RVAR00]] = load [[ST]]*, [[ST]]** @sd
2950
2951   // CK22: call void [[CALL09:@.+]]([[ST]]* {{[^,]+}})
2952   #pragma omp target map(sd[2:5])
2953   { sd[3].fa+=1; }
2954   
2955   // Region 10
2956   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
2957   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2958   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2959
2960   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2961   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2962   // CK22-DAG: store i8* bitcast ([[STT]]* @sta to i8*), i8** [[BP0]]
2963   // CK22-DAG: store i8* bitcast ([[STT]]* @sta to i8*), i8** [[P0]]
2964
2965   // CK22: call void [[CALL10:@.+]]([[STT]]* {{[^,]+}})
2966   #pragma omp target map(sta)
2967   { sta.fa+=1; }
2968   
2969   // Region 11
2970   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
2971   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2972   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2973
2974   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2975   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2976   // CK22-DAG: store i8* bitcast ([100 x [[STT]]]* @stc to i8*), i8** [[BP0]]
2977   // CK22-DAG: store i8* bitcast ([100 x [[STT]]]* @stc to i8*), i8** [[P0]]
2978
2979   // CK22: call void [[CALL11:@.+]]([100 x [[STT]]]* {{[^,]+}})
2980   #pragma omp target map(stc)
2981   { stc[3].fa+=1; }
2982   
2983   // Region 12
2984   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
2985   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2986   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2987
2988   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2989   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2990   // CK22-DAG: store i8* bitcast ([[STT]]** @std to i8*), i8** [[BP0]]
2991   // CK22-DAG: store i8* bitcast ([[STT]]** @std to i8*), i8** [[P0]]
2992
2993   // CK22: call void [[CALL12:@.+]]([[STT]]** {{[^,]+}})
2994   #pragma omp target map(std)
2995   { std[3].fa+=1; }
2996   
2997   // Region 13
2998   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
2999   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3000   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3001
3002   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3003   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3004   // CK22-DAG: store i8* bitcast ([100 x [[STT]]]* @stc to i8*), i8** [[BP0]]
3005   // CK22-DAG: store i8* bitcast ([[STT]]* getelementptr inbounds ([100 x [[STT]]], [100 x [[STT]]]* @stc, i{{.+}} 0, i{{.+}} 1) to i8*), i8** [[P0]]
3006
3007   // CK22: call void [[CALL13:@.+]]([100 x [[STT]]]* {{[^,]+}})
3008   #pragma omp target map(stc[1:4])
3009   { stc[3].fa+=1; }
3010   
3011   // Region 14
3012   // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
3013   // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3014   // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3015
3016   // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3017   // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3018   // CK22-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3019   // CK22-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3020   // CK22-DAG: [[CBPVAL0]] = bitcast [[STT]]* [[RVAR0:%.+]] to i8*
3021   // CK22-DAG: [[CPVAL0]] = bitcast [[STT]]* [[SEC0:%.+]] to i8*
3022   // CK22-DAG: [[RVAR0]] = load [[STT]]*, [[STT]]** @std
3023   // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[STT]]* [[RVAR00:%.+]], i{{.+}} 2
3024   // CK22-DAG: [[RVAR00]] = load [[STT]]*, [[STT]]** @std
3025
3026   // CK22: call void [[CALL14:@.+]]([[STT]]* {{[^,]+}})
3027   #pragma omp target map(std[2:5])
3028   { std[3].fa+=1; }
3029
3030   return 0;
3031 }
3032 // CK22: define {{.+}}[[CALL00]]
3033 // CK22: define {{.+}}[[CALL01]]
3034 // CK22: define {{.+}}[[CALL02]]
3035 // CK22: define {{.+}}[[CALL03]]
3036 // CK22: define {{.+}}[[CALL04]]
3037 // CK22: define {{.+}}[[CALL05]]
3038 // CK22: define {{.+}}[[CALL06]]
3039 // CK22: define {{.+}}[[CALL07]]
3040 // CK22: define {{.+}}[[CALL08]]
3041 // CK22: define {{.+}}[[CALL09]]
3042 // CK22: define {{.+}}[[CALL10]]
3043 // CK22: define {{.+}}[[CALL11]]
3044 // CK22: define {{.+}}[[CALL12]]
3045 // CK22: define {{.+}}[[CALL13]]
3046 // CK22: define {{.+}}[[CALL14]]
3047 #endif
3048 ///==========================================================================///
3049 // 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
3050 // 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
3051 // 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
3052 // 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
3053 // 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
3054 // 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
3055 #ifdef CK23
3056
3057 // CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
3058 // CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3059
3060 // CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
3061 // CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3062
3063 // CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
3064 // CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3065
3066 // CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
3067 // CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3068
3069 // CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
3070 // CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3071
3072 // CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
3073 // CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3074
3075 // CK23-LABEL: explicit_maps_inside_captured
3076 int explicit_maps_inside_captured(int a){
3077   float b;
3078   float c[100];
3079   float *d;
3080   
3081   // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}}) 
3082   // CK23: define {{.*}}explicit_maps_inside_captured{{.*}}
3083   [&](void){
3084     // Region 00
3085     // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
3086     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3087     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3088
3089     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3090     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3091     // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3092     // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3093     // CK23-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
3094     // CK23-DAG: [[CPVAL0]] = bitcast i32* [[VAR00:%.+]] to i8*
3095     // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]]
3096     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3097     // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]]
3098     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3099
3100     // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}})
3101     #pragma omp target map(a)
3102       { a+=1; }
3103     // Region 01
3104     // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3105     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3106     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3107
3108     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3109     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3110     // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3111     // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3112     // CK23-DAG: [[CBPVAL0]] = bitcast float* [[VAR0:%.+]] to i8*
3113     // CK23-DAG: [[CPVAL0]] = bitcast float* [[VAR00:%.+]] to i8*
3114     // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]]
3115     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3116     // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]]
3117     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3118
3119     // CK23: call void [[CALL01:@.+]](float* {{[^,]+}})
3120     #pragma omp target map(b)
3121       { b+=1; }
3122     // Region 02
3123     // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
3124     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3125     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3126
3127     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3128     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3129     // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3130     // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3131     // CK23-DAG: [[CBPVAL0]] = bitcast [100 x float]* [[VAR0:%.+]] to i8*
3132     // CK23-DAG: [[CPVAL0]] = bitcast [100 x float]* [[VAR00:%.+]] to i8*
3133     // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3134     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3135     // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3136     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3137
3138     // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}})
3139     #pragma omp target map(c)
3140       { c[3]+=1; }
3141       
3142     // Region 03
3143     // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
3144     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3145     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3146
3147     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3148     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3149     // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3150     // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3151     // CK23-DAG: [[CBPVAL0]] = bitcast float** [[VAR0:%.+]] to i8*
3152     // CK23-DAG: [[CPVAL0]] = bitcast float** [[VAR00:%.+]] to i8*
3153     // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3154     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3155     // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3156     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3157
3158     // CK23: call void [[CALL03:@.+]](float** {{[^,]+}})
3159     #pragma omp target map(d)
3160       { d[3]+=1; }
3161     // Region 04
3162     // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
3163     // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3164     // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3165
3166     // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3167     // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3168     // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3169     // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3170     // CK23-DAG: [[CBPVAL0]] = bitcast [100 x float]* [[VAR0:%.+]] to i8*
3171     // CK23-DAG: [[CPVAL0]] = bitcast float* [[SEC0:%.+]] to i8*
3172     // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3173     // 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 [[CALL04:@.+]]([100 x float]* {{[^,]+}})
3179     #pragma omp target map(c[2:4])
3180       { c[3]+=1; }
3181       
3182     // Region 05
3183     // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
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
3189     // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3190     // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3191     // CK23-DAG: [[CBPVAL0]] = bitcast float* [[RVAR0:%.+]] to i8*
3192     // CK23-DAG: [[CPVAL0]] = bitcast float* [[SEC0:%.+]] to i8*
3193     // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
3194     // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
3195     // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]]
3196     // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3197     // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3198     // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3199     // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3200         
3201     // CK23: call void [[CALL05:@.+]](float* {{[^,]+}})
3202     #pragma omp target map(d[2:4])
3203       { d[3]+=1; }
3204   }();
3205   return b;
3206 }
3207
3208 // CK23: define {{.+}}[[CALL00]]
3209 // CK23: define {{.+}}[[CALL01]]
3210 // CK23: define {{.+}}[[CALL02]]
3211 // CK23: define {{.+}}[[CALL03]]
3212 // CK23: define {{.+}}[[CALL04]]
3213 // CK23: define {{.+}}[[CALL05]]
3214 #endif
3215 ///==========================================================================///
3216 // 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
3217 // 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
3218 // 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
3219 // 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
3220 // 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
3221 // 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
3222 #ifdef CK24
3223
3224 // CK24-DAG: [[SC:%.+]] = type { i32, [[SB:%.+]], [[SB:%.+]]*, [10 x i32] }
3225 // CK24-DAG: [[SB]] = type { i32, [[SA:%.+]], [10 x [[SA:%.+]]], [10 x [[SA:%.+]]*], [[SA:%.+]]* }
3226 // CK24-DAG: [[SA]] = type { i32, [[SA]]*, [10 x i32] }
3227
3228 struct SA{
3229   int a;
3230   struct SA *p;
3231   int b[10];
3232 };
3233 struct SB{
3234   int a;
3235   struct SA s;
3236   struct SA sa[10];
3237   struct SA *sp[10];
3238   struct SA *p;
3239 };
3240 struct SC{
3241   int a;
3242   struct SB s;
3243   struct SB *p;
3244   int b[10];
3245 };
3246
3247 // CK24: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
3248 // CK24: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3249
3250 // CK24: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
3251 // CK24: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3252
3253 // CK24: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
3254 // CK24: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3255
3256 // CK24: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
3257 // CK24: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3258
3259 // CK24: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
3260 // CK24: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3261
3262 // CK24: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
3263 // CK24: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3264
3265 // CK24: [[SIZE07:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
3266 // CK24: [[MTYPE07:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3267
3268 // CK24: [[SIZE08:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
3269 // CK24: [[MTYPE08:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3270
3271 // CK24: [[SIZE09:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
3272 // CK24: [[MTYPE09:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3273
3274 // CK24: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 8]
3275 // CK24: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3276
3277 // CK24: [[SIZE11:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
3278 // CK24: [[MTYPE11:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3279
3280 // CK24: [[SIZE12:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
3281 // CK24: [[MTYPE12:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 19, i32 19, i32 19]
3282
3283 // CK24: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
3284 // CK24: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3285
3286 // CK24: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
3287 // CK24: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3288
3289 // CK24: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
3290 // CK24: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3291
3292 // CK24: [[SIZE16:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
3293 // CK24: [[MTYPE16:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3294
3295 // CK24: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
3296 // CK24: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3297
3298 // CK24: [[SIZE18:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
3299 // CK24: [[MTYPE18:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3300
3301 // CK24: [[SIZE19:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
3302 // CK24: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3303
3304 // CK24: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
3305 // CK24: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3306
3307 // CK24: [[SIZE21:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
3308 // CK24: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3309
3310 // CK24: [[SIZE22:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
3311 // CK24: [[MTYPE22:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
3312
3313 // CK24: [[SIZE23:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
3314 // CK24: [[MTYPE23:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
3315
3316 // CK24: [[SIZE24:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
3317 // CK24: [[MTYPE24:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 19, i32 19, i32 19]
3318
3319 // CK24-LABEL: explicit_maps_struct_fields
3320 int explicit_maps_struct_fields(int a){
3321   SC s;
3322   SC *p;
3323
3324 // Region 01
3325 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3326 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3327 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3328
3329 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3330 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3331 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3332 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3333 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3334 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3335 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
3336
3337 // CK24: call void [[CALL01:@.+]]([[SC]]* {{[^,]+}})
3338 #pragma omp target map(s.a)
3339   { s.a++; }
3340   
3341 // Region 02
3342 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
3343 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3344 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3345
3346 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3347 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3348 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3349 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3350 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3351 // CK24-DAG: [[CPVAL0]] = bitcast [[SA]]* [[SEC0:%.+]] to i8*
3352 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3353 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3354
3355 // CK24: call void [[CALL02:@.+]]([[SC]]* {{[^,]+}})
3356 #pragma omp target map(s.s.s)
3357   { s.a++; }
3358   
3359 // Region 03
3360 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
3361 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3362 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3363
3364 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3365 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3366 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3367 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3368 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3369 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3370 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3371 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3372 // CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3373
3374 // CK24: call void [[CALL03:@.+]]([[SC]]* {{[^,]+}})
3375 #pragma omp target map(s.s.s.a)
3376   { s.a++; }
3377
3378 // Region 04
3379 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
3380 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3381 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3382
3383 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3384 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3385 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3386 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3387 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3388 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3389 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3390 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 3
3391
3392 // CK24: call void [[CALL04:@.+]]([[SC]]* {{[^,]+}})
3393 #pragma omp target map(s.b[:5])
3394   { s.a++; }
3395   
3396 // Region 05
3397 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
3398 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3399 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3400
3401 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3402 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3403 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3404 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3405 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3406 // CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3407 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3408
3409 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3410 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3411 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3412 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3413 // CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3414 // CK24-DAG: [[CPVAL1]] = bitcast [[SB]]* [[SEC1:%.+]] to i8*
3415 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3416 // CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3417 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3418
3419 // CK24: call void [[CALL05:@.+]]([[SC]]* {{[^,]+}})  
3420 #pragma omp target map(s.p[:5])
3421   { s.a++; }
3422
3423 // Region 06
3424 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
3425 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3426 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3427
3428 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3429 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3430 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3431 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3432 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3433 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3434 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3435 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3436 // CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3437 // CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3438
3439 // CK24: call void [[CALL06:@.+]]([[SC]]* {{[^,]+}})
3440 #pragma omp target map(s.s.sa[3].a)
3441   { s.a++; }
3442   
3443 // Region 07
3444 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE07]]{{.+}})
3445 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3446 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3447
3448 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3449 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3450 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3451 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3452 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3453 // CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3454 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3455 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3456 // CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3457
3458 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3459 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3460 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3461 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3462 // CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3463 // CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3464 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3465 // CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3466 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3467 // CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3468 // CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3469
3470 // CK24: call void [[CALL07:@.+]]([[SC]]* {{[^,]+}}) 
3471 #pragma omp target map(s.s.sp[3]->a)
3472   { s.a++; }
3473
3474 // Region 08
3475 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE08]]{{.+}})
3476 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3477 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3478
3479 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3480 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3481 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3482 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3483 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3484 // CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3485 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3486
3487 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3488 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3489 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3490 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3491 // CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3492 // CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3493 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3494 // CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3495 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3496
3497 // CK24: call void [[CALL08:@.+]]([[SC]]* {{[^,]+}}) 
3498 #pragma omp target map(s.p->a)
3499   { s.a++; }
3500   
3501 // Region 09
3502 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE09]]{{.+}})
3503 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3504 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3505
3506 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3507 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3508 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3509 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3510 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3511 // CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3512 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3513 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3514
3515 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3516 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3517 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3518 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3519 // CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3520 // CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3521 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3522 // CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3523 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3524 // CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3525
3526 // CK24: call void [[CALL09:@.+]]([[SC]]* {{[^,]+}}) 
3527 #pragma omp target map(s.s.p->a)
3528   { s.a++; }
3529
3530 // Region 10
3531 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
3532 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3533 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3534
3535 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3536 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3537 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3538 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3539 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3540 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3541 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3542 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3543 // CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3544 // CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3545
3546 // CK24: call void [[CALL10:@.+]]([[SC]]* {{[^,]+}})
3547 #pragma omp target map(s.s.s.b[:2])
3548   { s.a++; }
3549   
3550 // Region 11
3551 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE11]]{{.+}})
3552 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3553 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3554
3555 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3556 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3557 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3558 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3559 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3560 // CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3561 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3562 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3563
3564 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3565 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3566 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3567 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3568 // CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3569 // CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3570 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3571 // CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3572 // CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3573 // CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3574 // CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3575
3576 // CK24: call void [[CALL11:@.+]]([[SC]]* {{[^,]+}}) 
3577 #pragma omp target map(s.s.p->b[:2])
3578   { s.a++; }
3579
3580 // Region 12
3581 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE12]]{{.+}})
3582 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3583 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3584
3585 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3586 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3587 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3588 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3589 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3590 // CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3591 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3592
3593 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3594 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3595 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3596 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3597 // CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3598 // CK24-DAG: [[CPVAL1]] = bitcast [[SA]]** [[SEC1:%.+]] to i8*
3599 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3600 // CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3601 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3602
3603 // CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3604 // CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
3605 // CK24-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
3606 // CK24-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
3607 // CK24-DAG: [[CBPVAL2]] = bitcast [[SA]]** [[SEC1]] to i8*
3608 // CK24-DAG: [[CPVAL2]] = bitcast [[SA]]** [[SEC2:%.+]] to i8*
3609 // CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3610 // CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
3611 // CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3612 // CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
3613 // CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3614
3615 // CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
3616 // CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
3617 // CK24-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
3618 // CK24-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
3619 // CK24-DAG: [[CBPVAL3]] = bitcast [[SA]]** [[SEC2]] to i8*
3620 // CK24-DAG: [[CPVAL3]] = bitcast i32* [[SEC3:%.+]] to i8*
3621 // CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3622 // CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
3623 // CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3624 // CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
3625 // CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3626 // CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
3627 // CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3628
3629 // CK24: call void [[CALL12:@.+]]([[SC]]* {{[^,]+}})
3630 #pragma omp target map(s.p->p->p->a)
3631   { s.a++; }
3632
3633 //
3634 // Same thing but starting from a pointer.
3635 //
3636 // Region 13
3637 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
3638 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3639 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3640
3641 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3642 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3643 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3644 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3645 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3646 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3647 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 0
3648
3649 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3650 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3651
3652 // CK24: call void [[CALL13:@.+]]([[SC]]* {{[^,]+}})
3653 #pragma omp target map(p->a)
3654   { p->a++; }
3655   
3656 // Region 14
3657 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
3658 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3659 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3660
3661 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3662 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3663 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3664 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3665 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3666 // CK24-DAG: [[CPVAL0]] = bitcast [[SA]]* [[SEC0:%.+]] to i8*
3667 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3668 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3669
3670 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3671 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3672
3673 // CK24: call void [[CALL14:@.+]]([[SC]]* {{[^,]+}})
3674 #pragma omp target map(p->s.s)
3675   { p->a++; }
3676   
3677 // Region 15
3678 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
3679 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3680 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3681
3682 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3683 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3684 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3685 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3686 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3687 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3688 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3689 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3690 // CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3691
3692 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3693 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3694
3695 // CK24: call void [[CALL15:@.+]]([[SC]]* {{[^,]+}})
3696 #pragma omp target map(p->s.s.a)
3697   { p->a++; }
3698
3699 // Region 16
3700 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE16]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE16]]{{.+}})
3701 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3702 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3703
3704 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3705 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3706 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3707 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3708 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3709 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3710 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3711 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 3
3712
3713 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3714 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3715
3716 // CK24: call void [[CALL16:@.+]]([[SC]]* {{[^,]+}})
3717 #pragma omp target map(p->b[:5])
3718   { p->a++; }
3719   
3720 // Region 17
3721 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
3722 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3723 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3724
3725 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3726 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3727 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3728 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3729 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3730 // CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3731 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3732
3733 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3734 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3735 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3736 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3737 // CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3738 // CK24-DAG: [[CPVAL1]] = bitcast [[SB]]* [[SEC1:%.+]] to i8*
3739 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3740 // CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3741 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3742
3743 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3744 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3745 // CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3746
3747 // CK24: call void [[CALL17:@.+]]([[SC]]* {{[^,]+}}) 
3748 #pragma omp target map(p->p[:5])
3749   { p->a++; }
3750
3751 // Region 18
3752 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE18]]{{.+}})
3753 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3754 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3755
3756 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3757 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3758 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3759 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3760 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3761 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3762 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3763 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3764 // CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3765 // CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3766
3767 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3768 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3769
3770 // CK24: call void [[CALL18:@.+]]([[SC]]* {{[^,]+}})
3771 #pragma omp target map(p->s.sa[3].a)
3772   { p->a++; }
3773   
3774 // Region 19
3775 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE19]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
3776 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3777 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3778
3779 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3780 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3781 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3782 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3783 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3784 // CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3785 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3786 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3787 // CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3788
3789 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3790 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3791 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3792 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3793 // CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3794 // CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3795 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3796 // CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3797 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3798 // CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3799 // CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3800
3801 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3802 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3803 // CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3804
3805 // CK24: call void [[CALL19:@.+]]([[SC]]* {{[^,]+}}) 
3806 #pragma omp target map(p->s.sp[3]->a)
3807   { p->a++; }
3808
3809 // Region 20
3810 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
3811 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3812 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3813
3814 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3815 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3816 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3817 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3818 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3819 // CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3820 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3821
3822 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3823 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3824 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3825 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3826 // CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3827 // CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3828 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3829 // CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3830 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3831
3832 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3833 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3834 // CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3835
3836 // CK24: call void [[CALL20:@.+]]([[SC]]* {{[^,]+}})
3837 #pragma omp target map(p->p->a)
3838   { p->a++; }
3839   
3840 // Region 21
3841 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE21]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
3842 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3843 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3844
3845 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3846 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3847 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3848 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3849 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3850 // CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3851 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3852 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3853
3854 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3855 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3856 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3857 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3858 // CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3859 // CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3860 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3861 // CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3862 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3863 // CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3864
3865 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3866 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3867 // CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3868
3869 // CK24: call void [[CALL21:@.+]]([[SC]]* {{[^,]+}}) 
3870 #pragma omp target map(p->s.p->a)
3871   { p->a++; }
3872
3873 // Region 22
3874 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE22]]{{.+}})
3875 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3876 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3877
3878 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3879 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3880 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3881 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3882 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3883 // CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3884 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3885 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3886 // CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3887 // CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3888
3889 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3890 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3891
3892 // CK24: call void [[CALL22:@.+]]([[SC]]* {{[^,]+}})
3893 #pragma omp target map(p->s.s.b[:2])
3894   { p->a++; }
3895   
3896 // Region 23
3897 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE23]]{{.+}})
3898 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3899 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3900
3901 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3902 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3903 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3904 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3905 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3906 // CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3907 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3908 // CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3909
3910 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3911 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3912 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3913 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3914 // CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3915 // CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3916 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3917 // CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3918 // CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3919 // CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3920 // CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3921
3922 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3923 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3924 // CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3925
3926 // CK24: call void [[CALL23:@.+]]([[SC]]* {{[^,]+}}) 
3927 #pragma omp target map(p->s.p->b[:2])
3928   { p->a++; }
3929
3930 // Region 24
3931 // CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE24]]{{.+}})
3932 // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3933 // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3934
3935 // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3936 // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3937 // CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3938 // CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3939 // CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3940 // CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3941 // CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3942
3943 // CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3944 // CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3945 // CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3946 // CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3947 // CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3948 // CK24-DAG: [[CPVAL1]] = bitcast [[SA]]** [[SEC1:%.+]] to i8*
3949 // CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3950 // CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3951 // CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3952
3953 // CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3954 // CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
3955 // CK24-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
3956 // CK24-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
3957 // CK24-DAG: [[CBPVAL2]] = bitcast [[SA]]** [[SEC1]] to i8*
3958 // CK24-DAG: [[CPVAL2]] = bitcast [[SA]]** [[SEC2:%.+]] to i8*
3959 // CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3960 // CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
3961 // CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3962 // CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
3963 // CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0000:%.+]], i{{.+}} 0, i{{.+}} 2
3964
3965 // CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
3966 // CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
3967 // CK24-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
3968 // CK24-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
3969 // CK24-DAG: [[CBPVAL3]] = bitcast [[SA]]** [[SEC2]] to i8*
3970 // CK24-DAG: [[CPVAL3]] = bitcast i32* [[SEC3:%.+]] to i8*
3971 // CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3972 // CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
3973 // CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3974 // CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
3975 // CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3976 // CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
3977 // CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR00000:%.+]], i{{.+}} 0, i{{.+}} 2
3978
3979 // CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3980 // CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3981 // CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3982 // CK24-DAG: [[VAR0000]] = load [[SC]]*, [[SC]]** %{{.+}}
3983 // CK24-DAG: [[VAR00000]] = load [[SC]]*, [[SC]]** %{{.+}}
3984
3985 // CK24: call void [[CALL24:@.+]]([[SC]]* {{[^,]+}})
3986 #pragma omp target map(p->p->p->p->a)
3987   { p->a++; }
3988
3989   return s.a;
3990 }
3991
3992 // CK24: define {{.+}}[[CALL01]]
3993 // CK24: define {{.+}}[[CALL02]]
3994 // CK24: define {{.+}}[[CALL03]]
3995 // CK24: define {{.+}}[[CALL04]]
3996 // CK24: define {{.+}}[[CALL05]]
3997 // CK24: define {{.+}}[[CALL06]]
3998 // CK24: define {{.+}}[[CALL07]]
3999 // CK24: define {{.+}}[[CALL08]]
4000 // CK24: define {{.+}}[[CALL09]]
4001 // CK24: define {{.+}}[[CALL10]]
4002 // CK24: define {{.+}}[[CALL11]]
4003 // CK24: define {{.+}}[[CALL12]]
4004 // CK24: define {{.+}}[[CALL13]]
4005 // CK24: define {{.+}}[[CALL14]]
4006 // CK24: define {{.+}}[[CALL15]]
4007 // CK24: define {{.+}}[[CALL16]]
4008 // CK24: define {{.+}}[[CALL17]]
4009 // CK24: define {{.+}}[[CALL18]]
4010 // CK24: define {{.+}}[[CALL19]]
4011 // CK24: define {{.+}}[[CALL20]]
4012 // CK24: define {{.+}}[[CALL21]]
4013 // CK24: define {{.+}}[[CALL22]]
4014 // CK24: define {{.+}}[[CALL23]]
4015 // CK24: define {{.+}}[[CALL24]]
4016 #endif
4017 ///==========================================================================///
4018 // 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
4019 // 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
4020 // 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
4021 // 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
4022 // 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
4023 // 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
4024 #ifdef CK25
4025 // CK25: [[ST:%.+]] = type { i32, float }
4026 // CK25: [[CA00:%.+]] = type { [[ST]]* }
4027 // CK25: [[CA01:%.+]] = type { i32* }
4028
4029 // CK25: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
4030 // CK25: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
4031
4032 // CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
4033 // CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
4034
4035 // CK25-LABEL: explicit_maps_with_inner_lambda
4036
4037 template <int X, typename T>
4038 struct CC {
4039   T A;
4040   float B;
4041
4042   int foo(T arg) {
4043     // Region 00
4044     // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4045     // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4046     // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4047
4048     // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4049     // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4050     // CK25-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4051     // CK25-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4052     // CK25-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4053     // CK25-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4054     // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
4055
4056     // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
4057     #pragma omp target map(to:A)
4058     {
4059       [&]() {
4060         A += 1;
4061       }();
4062     }
4063
4064     // Region 01
4065     // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4066     // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4067     // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4068
4069     // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4070     // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4071     // CK25-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4072     // CK25-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4073     // CK25-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
4074     // CK25-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
4075
4076     // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}})
4077     #pragma omp target map(to:arg)
4078     {
4079       [&]() {
4080         arg += 1;
4081       }();
4082     }
4083
4084     return A+arg;
4085   }
4086 };
4087
4088 int explicit_maps_with_inner_lambda(int a){
4089   CC<123,int> c;
4090   return c.foo(a);
4091 }
4092
4093 // CK25: define {{.+}}[[CALL00]]([[ST]]* [[VAL:%.+]])
4094 // CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]],
4095 // CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]],
4096 // CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0
4097 // CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]],
4098 // CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* [[CA]])
4099
4100 // CK25: define {{.+}}[[LAMBDA]]
4101
4102 // CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]])
4103 // CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]],
4104 // CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]],
4105 // CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0
4106 // CK25: store i32* [[VAL1]], i32** [[VALADDR1]],
4107 // CK25: call void {{.*}}[[LAMBDA2:@.+]]{{.*}}([[CA01]]* [[CA]])
4108
4109 // CK25: define {{.+}}[[LAMBDA2]]
4110 #endif
4111 ///==========================================================================///
4112 // 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
4113 // 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
4114 // 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
4115 // 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
4116 // 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
4117 // 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
4118 #ifdef CK26
4119 // CK26: [[ST:%.+]] = type { i32, float*, i32, float* }
4120
4121 // CK26: [[SIZE00:@.+]] = private {{.*}}constant [2 x i[[Z:64|32]]] [i[[Z:64|32]] {{32|16}}, i[[Z:64|32]] 4]
4122 // CK26: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
4123
4124 // CK26: [[SIZE01:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
4125 // CK26: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
4126
4127 // CK26: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
4128 // CK26: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
4129
4130 // CK26: [[SIZE03:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
4131 // CK26: [[MTYPE03:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
4132
4133 // CK26-LABEL: explicit_maps_with_private_class_members
4134
4135 struct CC {
4136   int fA;
4137   float &fB;
4138   int pA;
4139   float &pB;
4140
4141   CC(float &B) : fB(B), pB(B) {
4142
4143     // CK26: call {{.*}}@__kmpc_fork_call{{.*}} [[OUTCALL:@.+]] to void (i32*, i32*, ...)*
4144     // define {{.*}}void [[OUTCALL]]
4145     #pragma omp parallel firstprivate(fA,fB) private(pA,pB)
4146     {
4147       // Region 00
4148       // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}})
4149       // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4150       // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4151
4152       // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4153       // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4154       // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4155       // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4156       // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4157       // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4158
4159       // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4160       // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4161       // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4162       // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4163       // CK26-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
4164       // CK26-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
4165       // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4166       // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4167
4168       // CK26: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4169       #pragma omp target map(fA)
4170       {
4171         ++fA;
4172       }
4173
4174       // Region 01
4175       // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}})
4176       // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4177       // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4178
4179       // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4180       // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4181       // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4182       // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4183       // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4184       // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4185
4186       // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4187       // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4188       // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4189       // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4190       // CK26-DAG: [[CBPVAL1]] = bitcast float* [[VAR1:%.+]] to i8*
4191       // CK26-DAG: [[CPVAL1]] = bitcast float* [[SEC1:%.+]] to i8*
4192       // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4193       // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4194
4195       // CK26: call void [[CALL01:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4196       #pragma omp target map(fB)
4197       {
4198         fB += 1.0;
4199       }
4200
4201       // Region 02
4202       // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
4203       // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4204       // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4205
4206       // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4207       // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4208       // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4209       // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4210       // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4211       // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4212
4213       // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4214       // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4215       // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4216       // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4217       // CK26-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
4218       // CK26-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
4219       // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4220       // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4221
4222       // CK26: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4223       #pragma omp target map(pA)
4224       {
4225         ++pA;
4226       }
4227
4228       // Region 01
4229       // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE03]]{{.+}})
4230       // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4231       // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4232
4233       // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4234       // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4235       // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4236       // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4237       // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4238       // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4239
4240       // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4241       // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4242       // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4243       // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4244       // CK26-DAG: [[CBPVAL1]] = bitcast float* [[VAR1:%.+]] to i8*
4245       // CK26-DAG: [[CPVAL1]] = bitcast float* [[SEC1:%.+]] to i8*
4246       // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4247       // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4248
4249       // CK26: call void [[CALL03:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4250       #pragma omp target map(pB)
4251       {
4252         pB += 1.0;
4253       }
4254     }
4255   }
4256
4257   int foo() {
4258     return fA + pA;
4259   }
4260 };
4261
4262 // Make sure the private instance is used in all target regions.
4263 // CK26: define {{.+}}[[CALL00]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4264 // CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4265 // CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4266 // CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4267 // CK26: add nsw i32 [[VAL]], 1
4268
4269 // CK26: define {{.+}}[[CALL01]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4270 // CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4271 // CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4272 // CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4273 // CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4274 // CK26: fadd double [[EXT]], 1.000000e+00
4275
4276 // CK26: define {{.+}}[[CALL02]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4277 // CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4278 // CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4279 // CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4280 // CK26: add nsw i32 [[VAL]], 1
4281
4282 // CK26: define {{.+}}[[CALL03]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4283 // CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4284 // CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4285 // CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4286 // CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4287 // CK26: fadd double [[EXT]], 1.000000e+00
4288
4289 int explicit_maps_with_private_class_members(){
4290   float B;
4291   CC c(B);
4292   return c.foo();
4293 }
4294 #endif
4295 ///==========================================================================///
4296 // 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
4297 // 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
4298 // 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
4299 // 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
4300 // 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
4301 // 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
4302 #ifdef CK27
4303
4304 // CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] zeroinitializer
4305 // CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
4306
4307 // CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4308 // CK27: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4309
4310 // CK27: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4311 // CK27: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4312
4313 // CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4314 // CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4315
4316 // CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4317 // CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
4318
4319 // CK27: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
4320 // CK27: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 288]
4321
4322 // CK27: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 40]
4323 // CK27: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 161]
4324
4325 // CK27-LABEL: zero_size_section_and_private_maps
4326 void zero_size_section_and_private_maps (int ii){
4327
4328   // Map of a pointer.
4329   int *pa;
4330
4331   // Region 00
4332   // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4333   // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4334   // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4335
4336   // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4337   // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4338   // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4339   // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4340   // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
4341   // CK27-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
4342
4343   // CK27: call void [[CALL00:@.+]](i32* {{[^,]+}})
4344   #pragma omp target
4345   {
4346     pa[50]++;
4347   }
4348
4349   // Region 01
4350   // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4351   // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4352   // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4353
4354   // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4355   // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4356   // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4357   // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4358   // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
4359   // CK27-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4360   // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4361   // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4362   // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4363
4364   // CK27: call void [[CALL01:@.+]](i32* {{[^,]+}})
4365   #pragma omp target map(pa[:0])
4366   {
4367     pa[50]++;
4368   }
4369
4370   // Region 02
4371   // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
4372   // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4373   // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4374
4375   // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4376   // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4377   // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4378   // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4379   // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
4380   // CK27-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4381   // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4382   // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4383   // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4384
4385   // CK27: call void [[CALL02:@.+]](i32* {{[^,]+}})
4386   #pragma omp target map(pa[0:0])
4387   {
4388     pa[50]++;
4389   }
4390
4391   // Region 03
4392   // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
4393   // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4394   // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4395
4396   // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4397   // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4398   // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4399   // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4400   // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
4401   // CK27-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4402   // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4403   // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.+}}
4404   // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4405
4406   // CK27: call void [[CALL03:@.+]](i32* {{[^,]+}})
4407   #pragma omp target map(pa[ii:0])
4408   {
4409     pa[50]++;
4410   }
4411
4412   int *pvtPtr;
4413   int pvtScl;
4414   int pvtArr[10];
4415
4416   // Region 04
4417   // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4418   // CK27: call void [[CALL04:@.+]]()
4419   #pragma omp target private(pvtPtr)
4420   {
4421     pvtPtr[5]++;
4422   }
4423
4424   // Region 05
4425   // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
4426   // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4427   // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4428
4429   // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4430   // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4431   // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4432   // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4433   // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
4434   // CK27-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
4435
4436   // CK27: call void [[CALL05:@.+]](i32* {{[^,]+}})
4437   #pragma omp target firstprivate(pvtPtr)
4438   {
4439     pvtPtr[5]++;
4440   }
4441
4442   // Region 06
4443   // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4444   // CK27: call void [[CALL06:@.+]]()
4445   #pragma omp target private(pvtScl)
4446   {
4447     pvtScl++;
4448   }
4449
4450   // Region 07
4451   // CK27-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZE07]]{{.+}}, {{.+}}[[MTYPE07]]{{.+}})
4452   // CK27-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
4453   // CK27-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
4454   // CK27-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
4455   // CK27-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
4456   // CK27-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
4457   // CK27-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
4458   // CK27-DAG: [[VALBP]] = inttoptr i[[Z]] [[VAL:%.+]] to i8*
4459   // CK27-DAG: [[VALP]] = inttoptr i[[Z]] [[VAL:%.+]] to i8*
4460   // CK27-DAG: [[VAL]] = load i[[Z]], i[[Z]]* [[ADDR:%.+]],
4461   // CK27-64-DAG: [[CADDR:%.+]] = bitcast i[[Z]]* [[ADDR]] to i32*
4462   // CK27-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
4463
4464   // CK27: call void [[CALL07:@.+]](i[[Z]] [[VAL]])
4465   #pragma omp target firstprivate(pvtScl)
4466   {
4467     pvtScl++;
4468   }
4469
4470   // Region 08
4471   // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4472   // CK27: call void [[CALL08:@.+]]()
4473   #pragma omp target private(pvtArr)
4474   {
4475     pvtArr[5]++;
4476   }
4477
4478   // Region 09
4479   // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
4480   // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4481   // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4482
4483   // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4484   // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4485   // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4486   // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4487   // CK27-DAG: [[CBPVAL0]] = bitcast [10 x i32]* [[VAR0:%.+]] to i8*
4488   // CK27-DAG: [[CPVAL0]] = bitcast [10 x i32]* [[VAR0]] to i8*
4489
4490   // CK27: call void [[CALL09:@.+]]([10 x i32]* {{[^,]+}})
4491   #pragma omp target firstprivate(pvtArr)
4492   {
4493     pvtArr[5]++;
4494   }
4495 }
4496
4497 // CK27: define {{.+}}[[CALL00]]
4498 // CK27: define {{.+}}[[CALL01]]
4499 // CK27: define {{.+}}[[CALL02]]
4500 // CK27: define {{.+}}[[CALL03]]
4501 // CK27: define {{.+}}[[CALL04]]
4502 // CK27: define {{.+}}[[CALL05]]
4503 // CK27: define {{.+}}[[CALL06]]
4504 // CK27: define {{.+}}[[CALL07]]
4505 #endif
4506 ///==========================================================================///
4507 // 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
4508 // 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
4509 // 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
4510 // 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
4511 // 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
4512 // 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
4513 #ifdef CK28
4514
4515 // CK28: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] {{8|4}}]
4516 // CK28: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4517
4518 // CK28: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
4519 // CK28: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4520
4521 // CK28-LABEL: explicit_maps_pointer_references
4522 void explicit_maps_pointer_references (int *p){
4523   int *&a = p;
4524
4525   // Region 00
4526   // CK28-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4527   // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4528   // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4529
4530   // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4531   // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4532   // CK28-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4533   // CK28-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4534   // CK28-DAG: [[CBPVAL0]] = bitcast i32** [[VAR0:%.+]] to i8*
4535   // CK28-DAG: [[CPVAL0]] = bitcast i32** [[VAR1:%.+]] to i8*
4536   // CK28-DAG: [[VAR0]] = load i32**, i32*** [[VAR00:%.+]],
4537   // CK28-DAG: [[VAR1]] = load i32**, i32*** [[VAR11:%.+]],
4538
4539   // CK28: call void [[CALL00:@.+]](i32** {{[^,]+}})
4540   #pragma omp target map(a)
4541   {
4542     ++a;
4543   }
4544
4545   // Region 01
4546   // CK28-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4547   // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4548   // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4549
4550   // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4551   // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4552   // CK28-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4553   // CK28-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4554   // CK28-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
4555   // CK28-DAG: [[CPVAL0]] = bitcast i32* [[VAR1:%.+]] to i8*
4556   // CK28-DAG: [[VAR0]] = load i32*, i32** [[VAR00:%.+]],
4557   // CK28-DAG: [[VAR00]] = load i32**, i32*** [[VAR000:%.+]],
4558   // CK28-DAG: [[VAR1]] = getelementptr inbounds i32, i32* [[VAR11:%.+]], i{{64|32}} 2
4559   // CK28-DAG: [[VAR11]] = load i32*, i32** [[VAR111:%.+]],
4560   // CK28-DAG: [[VAR111]] = load i32**, i32*** [[VAR1111:%.+]],
4561
4562   // CK28: call void [[CALL01:@.+]](i32* {{[^,]+}})
4563   #pragma omp target map(a[2:100])
4564   {
4565     ++a;
4566   }
4567 }
4568 #endif
4569 ///==========================================================================///
4570 // 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
4571 // 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
4572 // 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
4573 // 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
4574 // 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
4575 // 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
4576 #ifdef CK29
4577
4578 // CK29: [[SSA:%.+]] = type { double*, double** }
4579 // CK29: [[SSB:%.+]]  = type { [[SSA]]*, [[SSA]]** }
4580
4581 // 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]
4582 // CK29: [[MTYPE00:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 16, i32 19, i32 19]
4583
4584 // CK29: [[SIZE01:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 80]
4585 // CK29: [[MTYPE01:@.+]] = private {{.*}}constant [4 x i32] [i32 32, i32 19, i32 19, i32 19]
4586
4587 // 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]
4588 // CK29: [[MTYPE02:@.+]] = private {{.*}}constant [5 x i32] [i32 32, i32 19, i32 16, i32 19, i32 19]
4589
4590 struct SSA{
4591   double *p;
4592   double *&pr;
4593   SSA(double *&pr) : pr(pr) {}
4594 };
4595
4596 struct SSB{
4597   SSA *p;
4598   SSA *&pr;
4599   SSB(SSA *&pr) : pr(pr) {}
4600
4601   // CK29-LABEL: define {{.+}}foo
4602   void foo() {
4603
4604     // Region 00
4605     // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE00]]{{.+}})
4606
4607     // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4608     // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4609
4610     // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4611     // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4612     // CK29-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4613     // CK29-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4614     // CK29-DAG: [[CBPVAL0]] = bitcast [[SSB]]* [[VAR0:%.+]] to i8*
4615     // CK29-DAG: [[CPVAL0]] = bitcast [[SSA]]** [[VAR00:%.+]] to i8*
4616     // CK29-DAG: [[VAR0]] = load [[SSB]]*, [[SSB]]** %
4617     // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 0
4618
4619     // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4620     // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4621     // CK29-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4622     // CK29-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4623     // CK29-DAG: [[CBPVAL1]] = bitcast [[SSA]]** [[VAR00]] to i8*
4624     // CK29-DAG: [[CPVAL1]] = bitcast double*** [[VAR1:%.+]] to i8*
4625     // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4626
4627     // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4628     // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
4629     // CK29-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
4630     // CK29-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
4631     // CK29-DAG: [[CBPVAL2]] = bitcast double*** [[VAR1]] to i8*
4632     // CK29-DAG: [[CPVAL2]] = bitcast double** [[VAR2:%.+]] to i8*
4633     // CK29-DAG: [[VAR2]] = load double**, double*** [[VAR22:%.+]],
4634     // CK29-DAG: [[VAR22]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4635
4636     // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4637     // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
4638     // CK29-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
4639     // CK29-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
4640     // CK29-DAG: [[CBPVAL3]] = bitcast double** [[VAR2]] to i8*
4641     // CK29-DAG: [[CPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
4642     // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4643     // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4644
4645     // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4646     #pragma omp target map(p->pr[:10])
4647     {
4648       p->pr++;
4649     }
4650
4651     // Region 01
4652     // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE01]]{{.+}})
4653
4654     // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4655     // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4656
4657     // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4658     // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4659     // CK29-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4660     // CK29-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4661     // CK29-DAG: [[CBPVAL0]] = bitcast [[SSB]]* [[VAR0:%.+]] to i8*
4662     // CK29-DAG: [[CPVAL0]] = bitcast [[SSA]]*** [[VAR00:%.+]] to i8*
4663     // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4664
4665     // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4666     // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4667     // CK29-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4668     // CK29-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4669     // CK29-DAG: [[CBPVAL1]] = bitcast [[SSA]]*** [[VAR00]] to i8*
4670     // CK29-DAG: [[CPVAL1]] = bitcast [[SSA]]** [[VAR1:%.+]] to i8*
4671     // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4672
4673     // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4674     // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
4675     // CK29-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
4676     // CK29-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
4677     // CK29-DAG: [[CBPVAL2]] = bitcast [[SSA]]** [[VAR1]] to i8*
4678     // CK29-DAG: [[CPVAL2]] = bitcast double** [[VAR2:%.+]] to i8*
4679     // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 0
4680
4681     // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4682     // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
4683     // CK29-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
4684     // CK29-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
4685     // CK29-DAG: [[CBPVAL3]] = bitcast double** [[VAR2]] to i8*
4686     // CK29-DAG: [[CPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
4687     // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4688     // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4689
4690     // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4691     #pragma omp target map(pr->p[:10])
4692     {
4693       pr->p++;
4694     }
4695
4696     // Region 02
4697     // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 5, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[MTYPE02]]{{.+}})
4698
4699     // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4700     // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4701
4702     // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4703     // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4704     // CK29-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4705     // CK29-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4706     // CK29-DAG: [[CBPVAL0]] = bitcast [[SSB]]* [[VAR0:%.+]] to i8*
4707     // CK29-DAG: [[CPVAL0]] = bitcast [[SSA]]*** [[VAR00:%.+]] to i8*
4708     // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4709
4710     // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4711     // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4712     // CK29-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4713     // CK29-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4714     // CK29-DAG: [[CBPVAL1]] = bitcast [[SSA]]*** [[VAR00]] to i8*
4715     // CK29-DAG: [[CPVAL1]] = bitcast [[SSA]]** [[VAR1:%.+]] to i8*
4716     // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4717
4718     // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4719     // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
4720     // CK29-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
4721     // CK29-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
4722     // CK29-DAG: [[CBPVAL2]] = bitcast [[SSA]]** [[VAR1]] to i8*
4723     // CK29-DAG: [[CPVAL2]] = bitcast double*** [[VAR2:%.+]] to i8*
4724     // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4725
4726     // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4727     // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
4728     // CK29-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
4729     // CK29-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
4730     // CK29-DAG: [[CBPVAL3]] = bitcast double*** [[VAR2]] to i8*
4731     // CK29-DAG: [[CPVAL3]] = bitcast double** [[VAR3:%.+]] to i8*
4732     // CK29-DAG: [[VAR3]] = load double**, double*** [[VAR2]],
4733
4734     // CK29-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 4
4735     // CK29-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 4
4736     // CK29-DAG: store i8* [[CBPVAL4:%[^,]+]], i8** [[BP4]]
4737     // CK29-DAG: store i8* [[CPVAL4:%[^,]+]], i8** [[P4]]
4738     // CK29-DAG: [[CBPVAL4]] = bitcast double** [[VAR3]] to i8*
4739     // CK29-DAG: [[CPVAL4]] = bitcast double* [[VAR4:%.+]] to i8*
4740     // CK29-DAG: [[VAR4]] = getelementptr inbounds double, double* [[VAR44:%.+]], i{{.+}} 0
4741     // CK29-DAG: [[VAR44]] = load double*, double**
4742
4743     // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4744     #pragma omp target map(pr->pr[:10])
4745     {
4746       pr->pr++;
4747     }
4748   }
4749 };
4750
4751 void explicit_maps_member_pointer_references(SSA *sap) {
4752   double *d;
4753   SSA sa(d);
4754   SSB sb(sap);
4755   sb.foo();
4756 }
4757 #endif
4758 #endif