blob: 2f6cf3ccea5a8ac900530cec4f08e8668777b8a7 [file] [log] [blame]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001// expected-no-diagnostics
2#ifndef HEADER
3#define HEADER
4
5///
6/// Implicit maps.
7///
8
9///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +000010// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=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 -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
12// RUN: %clang_cc1 -fopenmp -fomptargets=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 -fomptargets=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 -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
15// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +000016#ifdef CK1
17
18// CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000019// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
20// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000021
22// CK1-LABEL: implicit_maps_integer
23void implicit_maps_integer (int a){
24 int i = a;
25
26 // CK1-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
27 // CK1-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
28 // CK1-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
29 // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
30 // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
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///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +000055// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fomptargets=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 -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
57// RUN: %clang_cc1 -fopenmp -fomptargets=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 -fomptargets=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 -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
60// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +000061#ifdef CK2
62
63// CK2-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000064// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
65// CK2-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000066
67// CK2-LABEL: implicit_maps_integer_reference
68void implicit_maps_integer_reference (int a){
69 int &i = a;
70 // CK2-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
71 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
72 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
73 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
74 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
75 // CK2-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
76 // CK2-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
77 // CK2-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
78 // CK2-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
79 // CK2-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
80 // CK2-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
81 // CK2-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
82
83 // CK2: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
84 #pragma omp target
85 {
86 ++i;
87 }
88}
89
90// CK2: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
91// CK2: [[ADDR:%.+]] = alloca i[[sz]],
92// CK2: [[REF:%.+]] = alloca i32*,
93// CK2: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
94// CK2-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
95// CK2-64: store i32* [[CADDR]], i32** [[REF]],
96// CK2-64: [[RVAL:%.+]] = load i32*, i32** [[REF]],
97// CK2-64: {{.+}} = load i32, i32* [[RVAL]],
98// CK2-32: store i32* [[ADDR]], i32** [[REF]],
99// CK2-32: [[RVAL:%.+]] = load i32*, i32** [[REF]],
100// CK2-32: {{.+}} = load i32, i32* [[RVAL]],
101
102#endif
103///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000104// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-64
105// RUN: %clang_cc1 -DCK3 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
106// RUN: %clang_cc1 -fopenmp -fomptargets=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
107// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-32
108// RUN: %clang_cc1 -DCK3 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
109// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000110#ifdef CK3
111
112// CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000113// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
114// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000115
116// CK3-LABEL: implicit_maps_parameter
117void implicit_maps_parameter (int a){
118
119 // CK3-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
120 // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
121 // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
122 // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
123 // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
124 // CK3-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
125 // CK3-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
126 // CK3-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
127 // CK3-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
128 // CK3-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
129 // CK3-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
130 // CK3-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
131
132 // CK3: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
133 #pragma omp target
134 {
135 ++a;
136 }
137}
138
139// CK3: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
140// CK3: [[ADDR:%.+]] = alloca i[[sz]],
141// CK3: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
142// CK3-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
143// CK3-64: {{.+}} = load i32, i32* [[CADDR]],
144// CK3-32: {{.+}} = load i32, i32* [[ADDR]],
145
146#endif
147///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000148// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-64
149// RUN: %clang_cc1 -DCK4 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
150// RUN: %clang_cc1 -fopenmp -fomptargets=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
151// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-32
152// RUN: %clang_cc1 -DCK4 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
153// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000154#ifdef CK4
155
156// CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000157// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
158// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000159
160// CK4-LABEL: implicit_maps_nested_integer
161void implicit_maps_nested_integer (int a){
162 int i = a;
163
164 // The captures in parallel are by reference. Only the capture in target is by
165 // copy.
166
167 // CK4: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP1:@.+]] to void (i32*, i32*, ...)*), i32* {{.+}})
168 // CK4: define internal void [[KERNELP1]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
169 #pragma omp parallel
170 {
171 // CK4-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
172 // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
173 // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
174 // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
175 // CK4-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
176 // CK4-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
177 // CK4-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
178 // CK4-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
179 // CK4-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
180 // CK4-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
181 // CK4-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
182 // CK4-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
183
184 // CK4: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
185 #pragma omp target
186 {
187 #pragma omp parallel
188 {
189 ++i;
190 }
191 }
192 }
193}
194
195// CK4: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
196// CK4: [[ADDR:%.+]] = alloca i[[sz]],
197// CK4: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
198// CK4-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
199// CK4-64: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[CADDR]])
200// CK4-32: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[ADDR]])
201// CK4: define internal void [[KERNELP2]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
202#endif
203///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000204// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-64
205// RUN: %clang_cc1 -DCK5 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
206// RUN: %clang_cc1 -fopenmp -fomptargets=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
207// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-32
208// RUN: %clang_cc1 -DCK5 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
209// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000210#ifdef CK5
211
212// CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000213// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
214// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000215
216// CK5-LABEL: implicit_maps_nested_integer_and_enum
217void implicit_maps_nested_integer_and_enum (int a){
218 enum Bla {
219 SomeEnum = 0x09
220 };
221
222 // Using an enum should not change the mapping information.
223 int i = a;
224
225 // CK5-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
226 // CK5-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
227 // CK5-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
228 // CK5-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
229 // CK5-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
230 // CK5-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
231 // CK5-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
232 // CK5-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
233 // CK5-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
234 // CK5-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
235 // CK5-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
236 // CK5-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
237
238 // CK5: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
239 #pragma omp target
240 {
241 ++i;
242 i += SomeEnum;
243 }
244}
245
246// CK5: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
247// CK5: [[ADDR:%.+]] = alloca i[[sz]],
248// CK5: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
249// CK5-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
250// CK5-64: {{.+}} = load i32, i32* [[CADDR]],
251// CK5-32: {{.+}} = load i32, i32* [[ADDR]],
252
253#endif
254///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000255// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-64
256// RUN: %clang_cc1 -DCK6 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
257// RUN: %clang_cc1 -fopenmp -fomptargets=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
258// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-32
259// RUN: %clang_cc1 -DCK6 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
260// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000261#ifdef CK6
262// CK6-DAG: [[GBL:@Gi]] = global i32 0
263// CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000264// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
265// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000266
267// CK6-LABEL: implicit_maps_host_global
268int Gi;
269void implicit_maps_host_global (int a){
270 // CK6-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
271 // CK6-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
272 // CK6-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
273 // CK6-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
274 // CK6-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
275 // CK6-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
276 // CK6-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
277 // CK6-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
278 // CK6-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
279 // CK6-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
280 // CK6-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
281 // CK6-64-DAG: store i32 [[GBLVAL:%.+]], i32* [[CADDR]],
282 // CK6-64-DAG: [[GBLVAL]] = load i32, i32* [[GBL]],
283 // CK6-32-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[GBLVAL:%.+]],
284
285 // CK6: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
286 #pragma omp target
287 {
288 ++Gi;
289 }
290}
291
292// CK6: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
293// CK6: [[ADDR:%.+]] = alloca i[[sz]],
294// CK6: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
295// CK6-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
296// CK6-64: {{.+}} = load i32, i32* [[CADDR]],
297// CK6-32: {{.+}} = load i32, i32* [[ADDR]],
298
299#endif
300///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000301// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-64
302// RUN: %clang_cc1 -DCK7 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
303// RUN: %clang_cc1 -fopenmp -fomptargets=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
304// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-32
305// RUN: %clang_cc1 -DCK7 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
306// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000307#ifdef CK7
308
309// For a 32-bit targets, the value doesn't fit the size of the pointer,
310// therefore it is passed by reference with a map 'to' specification.
311
312// CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000313// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
314// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
315// Map types: OMP_MAP_TO | OMP_MAP_IS_FIRST = 33
316// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000317
318// CK7-LABEL: implicit_maps_double
319void implicit_maps_double (int a){
320 double d = (double)a;
321
322 // CK7-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
323 // CK7-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
324 // CK7-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
325 // CK7-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
326 // CK7-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
327
328 // CK7-64-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
329 // CK7-64-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
330 // CK7-64-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
331 // CK7-64-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
332 // CK7-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
333 // CK7-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double*
334 // CK7-64-64-DAG: store double {{.+}}, double* [[CADDR]],
335
336 // CK7-32-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
337 // CK7-32-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
338 // CK7-32-DAG: [[VALBP]] = bitcast double* [[DECL:%.+]] to i8*
339 // CK7-32-DAG: [[VALP]] = bitcast double* [[DECL]] to i8*
340
341 // CK7-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
342 // CK7-32: call void [[KERNEL:@.+]](double* [[DECL]])
343 #pragma omp target
344 {
345 d += 1.0;
346 }
347}
348
349// CK7-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
350// CK7-64: [[ADDR:%.+]] = alloca i[[sz]],
351// CK7-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
352// CK7-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double*
353// CK7-64: {{.+}} = load double, double* [[CADDR]],
354
355// CK7-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]])
356// CK7-32: [[ADDR:%.+]] = alloca double*,
357// CK7-32: store double* [[ARG]], double** [[ADDR]],
358// CK7-32: [[REF:%.+]] = load double*, double** [[ADDR]],
359// CK7-32: {{.+}} = load double, double* [[REF]],
360
361#endif
362///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000363// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK8
364// RUN: %clang_cc1 -DCK8 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
365// RUN: %clang_cc1 -fopenmp -fomptargets=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
366// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK8
367// RUN: %clang_cc1 -DCK8 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
368// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK8
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000369#ifdef CK8
370
371// CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000372// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
373// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000374
375// CK8-LABEL: implicit_maps_float
376void implicit_maps_float (int a){
377 float f = (float)a;
378
379 // CK8-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
380 // CK8-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
381 // CK8-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
382 // CK8-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
383 // CK8-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
384 // CK8-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
385 // CK8-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
386 // CK8-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
387 // CK8-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
388 // CK8-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
389 // CK8-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
390 // CK8-DAG: store float {{.+}}, float* [[CADDR]],
391
392 // CK8: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
393 #pragma omp target
394 {
395 f += 1.0;
396 }
397}
398
399// CK8: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
400// CK8: [[ADDR:%.+]] = alloca i[[sz]],
401// CK8: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
402// CK8: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
403// CK8: {{.+}} = load float, float* [[CADDR]],
404
405#endif
406///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000407// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK9
408// RUN: %clang_cc1 -DCK9 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
409// RUN: %clang_cc1 -fopenmp -fomptargets=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
410// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK9
411// RUN: %clang_cc1 -DCK9 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
412// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK9
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000413#ifdef CK9
414
415// CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Samuel Antao6782e942016-05-26 16:48:10 +0000416// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
417// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 35]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000418
419// CK9-LABEL: implicit_maps_array
420void implicit_maps_array (int a){
421 double darr[2] = {(double)a, (double)a};
422
423 // CK9-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
424 // CK9-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
425 // CK9-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
426 // CK9-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
427 // CK9-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
428 // CK9-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
429 // CK9-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
430 // CK9-DAG: [[VALBP]] = bitcast [2 x double]* [[DECL:%.+]] to i8*
431 // CK9-DAG: [[VALP]] = bitcast [2 x double]* [[DECL]] to i8*
432
433 // CK9: call void [[KERNEL:@.+]]([2 x double]* [[DECL]])
434 #pragma omp target
435 {
436 darr[0] += 1.0;
437 darr[1] += 1.0;
438 }
439}
440
441// CK9: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]])
442// CK9: [[ADDR:%.+]] = alloca [2 x double]*,
443// CK9: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]],
444// CK9: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]],
445// CK9: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i[[sz]] 0, i[[sz]] 0
446#endif
447///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000448// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK10
449// RUN: %clang_cc1 -DCK10 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
450// RUN: %clang_cc1 -fopenmp -fomptargets=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
451// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK10
452// RUN: %clang_cc1 -DCK10 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
453// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK10
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000454#ifdef CK10
455
Samuel Antao6782e942016-05-26 16:48:10 +0000456// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] zeroinitializer
457// Map types: OMP_MAP_IS_FIRST = 32
458// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 32]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000459
460// CK10-LABEL: implicit_maps_pointer
461void implicit_maps_pointer (){
462 double *ddyn;
463
464 // CK10-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
465 // CK10-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
466 // CK10-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
467 // CK10-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
468 // CK10-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
469 // CK10-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
470 // CK10-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
471 // CK10-DAG: [[VALBP]] = bitcast double* [[PTR:%.+]] to i8*
472 // CK10-DAG: [[VALP]] = bitcast double* [[PTR]] to i8*
473
474 // CK10: call void [[KERNEL:@.+]](double* [[PTR]])
475 #pragma omp target
476 {
477 ddyn[0] += 1.0;
478 ddyn[1] += 1.0;
479 }
480}
481
482// CK10: define internal void [[KERNEL]](double* {{.*}}[[ARG:%.+]])
483// CK10: [[ADDR:%.+]] = alloca double*,
484// CK10: store double* [[ARG]], double** [[ADDR]],
485// CK10: [[REF:%.+]] = load double*, double** [[ADDR]],
486// CK10: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] 0
487
488#endif
489///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000490// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK11
491// RUN: %clang_cc1 -DCK11 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
492// RUN: %clang_cc1 -fopenmp -fomptargets=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
493// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK11
494// RUN: %clang_cc1 -DCK11 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
495// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK11
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000496#ifdef CK11
497
498// CK11-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Samuel Antao6782e942016-05-26 16:48:10 +0000499// Map types: OMP_MAP_TO + OMP_MAP_IS_FIRST = 33
500// CK11-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000501
502// CK11-LABEL: implicit_maps_double_complex
503void implicit_maps_double_complex (int a){
504 double _Complex dc = (double)a;
505
506 // CK11-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
507 // CK11-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
508 // CK11-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
509 // CK11-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
510 // CK11-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
511 // CK11-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
512 // CK11-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
513 // CK11-DAG: [[VALBP]] = bitcast { double, double }* [[PTR:%.+]] to i8*
514 // CK11-DAG: [[VALP]] = bitcast { double, double }* [[PTR]] to i8*
515
516 // CK11: call void [[KERNEL:@.+]]({ double, double }* [[PTR]])
517 #pragma omp target
518 {
519 dc *= dc;
520 }
521}
522
523// CK11: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]])
524// CK11: [[ADDR:%.+]] = alloca { double, double }*,
525// CK11: store { double, double }* [[ARG]], { double, double }** [[ADDR]],
526// CK11: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]],
527// CK11: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0
528#endif
529///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000530// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-64
531// RUN: %clang_cc1 -DCK12 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
532// RUN: %clang_cc1 -fopenmp -fomptargets=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
533// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-32
534// RUN: %clang_cc1 -DCK12 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
535// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000536#ifdef CK12
537
538// For a 32-bit targets, the value doesn't fit the size of the pointer,
539// therefore it is passed by reference with a map 'to' specification.
540
541// CK12-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000542// Map types: OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
543// CK12-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
544// Map types: OMP_MAP_TO + OMP_MAP_IS_FIRST = 33
545// CK12-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000546
547// CK12-LABEL: implicit_maps_float_complex
548void implicit_maps_float_complex (int a){
549 float _Complex fc = (float)a;
550
551 // CK12-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
552 // CK12-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
553 // CK12-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
554 // CK12-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
555 // CK12-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
556
557 // CK12-64-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
558 // CK12-64-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
559 // CK12-64-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
560 // CK12-64-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
561 // CK12-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
562 // CK12-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
563 // CK12-64-DAG: store { float, float } {{.+}}, { float, float }* [[CADDR]],
564
565 // CK12-32-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
566 // CK12-32-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
567 // CK12-32-DAG: [[VALBP]] = bitcast { float, float }* [[DECL:%.+]] to i8*
568 // CK12-32-DAG: [[VALP]] = bitcast { float, float }* [[DECL]] to i8*
569
570 // CK12-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
571 // CK12-32: call void [[KERNEL:@.+]]({ float, float }* [[DECL]])
572 #pragma omp target
573 {
574 fc *= fc;
575 }
576}
577
578// CK12-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
579// CK12-64: [[ADDR:%.+]] = alloca i[[sz]],
580// CK12-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
581// CK12-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
582// CK12-64: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[CADDR]], i32 0, i32 0
583
584// CK12-32: define internal void [[KERNEL]]({ float, float }* {{.+}}[[ARG:%.+]])
585// CK12-32: [[ADDR:%.+]] = alloca { float, float }*,
586// CK12-32: store { float, float }* [[ARG]], { float, float }** [[ADDR]],
587// CK12-32: [[REF:%.+]] = load { float, float }*, { float, float }** [[ADDR]],
588// CK12-32: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[REF]], i32 0, i32 0
589#endif
590///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000591// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK13
592// RUN: %clang_cc1 -DCK13 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
593// RUN: %clang_cc1 -fopenmp -fomptargets=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
594// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK13
595// RUN: %clang_cc1 -DCK13 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
596// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK13
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000597#ifdef CK13
598
599// We don't have a constant map size for VLAs.
600// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000601// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
602// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
603// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
604// CK13-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000605
606// CK13-LABEL: implicit_maps_variable_length_array
607void implicit_maps_variable_length_array (int a){
608 double vla[2][a];
609
610 // CK13-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i[[sz:64|32]]* [[SGEP:%[^,]+]], {{.+}}[[TYPES]]{{.+}})
611 // CK13-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
612 // CK13-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
613 // CK13-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SS:%[^,]+]], i32 0, i32 0
614
615 // CK13-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
616 // CK13-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
617 // CK13-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 0
618 // CK13-DAG: store i8* inttoptr (i[[sz]] 2 to i8*), i8** [[BP0]],
619 // CK13-DAG: store i8* inttoptr (i[[sz]] 2 to i8*), i8** [[P0]],
620 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S0]],
621
622 // CK13-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
623 // CK13-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
624 // CK13-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1
625 // CK13-DAG: store i8* [[VALBP1:%.+]], i8** [[BP1]],
626 // CK13-DAG: store i8* [[VALP1:%.+]], i8** [[P1]],
627 // CK13-DAG: [[VALBP1]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
628 // CK13-DAG: [[VALP1]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
629 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S1]],
630
631 // CK13-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
632 // CK13-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
633 // CK13-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2
634 // CK13-DAG: store i8* [[VALBP2:%.+]], i8** [[BP2]],
635 // CK13-DAG: store i8* [[VALP2:%.+]], i8** [[P2]],
636 // CK13-DAG: store i[[sz]] [[VALS2:%.+]], i[[sz]]* [[S2]],
637 // CK13-DAG: [[VALBP2]] = bitcast double* [[DECL:%.+]] to i8*
638 // CK13-DAG: [[VALP2]] = bitcast double* [[DECL]] to i8*
639 // CK13-DAG: [[VALS2]] = mul nuw i[[sz]] %{{.+}}, 8
640
641 // CK13: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]])
642 #pragma omp target
643 {
644 vla[1][3] += 1.0;
645 }
646}
647
648// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.+}}[[ARG:%.+]])
649// CK13: [[ADDR0:%.+]] = alloca i[[sz]],
650// CK13: [[ADDR1:%.+]] = alloca i[[sz]],
651// CK13: [[ADDR2:%.+]] = alloca double*,
652// CK13: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]],
653// CK13: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]],
654// CK13: store double* [[ARG]], double** [[ADDR2]],
655// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR0]],
656// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR1]],
657// CK13: [[REF:%.+]] = load double*, double** [[ADDR2]],
658// CK13: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}}
659#endif
660///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000661// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-64
662// RUN: %clang_cc1 -DCK14 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
663// RUN: %clang_cc1 -fopenmp -fomptargets=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
664// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-32
665// RUN: %clang_cc1 -DCK14 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
666// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000667#ifdef CK14
668
669// CK14-DAG: [[ST:%.+]] = type { i32, double }
670// CK14-DAG: [[SIZES:@.+]] = {{.+}}constant [2 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}, i{{64|32}} 4]
671// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000672// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
673// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
674// CK14-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000675
676class SSS {
677public:
678 int a;
679 double b;
680
681 void foo(int c) {
682 #pragma omp target
683 {
684 a += c;
685 b += (double)c;
686 }
687 }
688
689 SSS(int a, double b) : a(a), b(b) {}
690};
691
692// CK14-LABEL: implicit_maps_class
693void implicit_maps_class (int a){
694 SSS sss(a, (double)a);
695
696 // CK14: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
697 // CK14-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
698 // CK14-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
699 // CK14-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
700
701 // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
702 // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
703 // CK14-DAG: store i8* [[VALBP0:%.+]], i8** [[BP0]],
704 // CK14-DAG: store i8* [[VALP0:%.+]], i8** [[P0]],
705 // CK14-DAG: [[VALBP0]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
706 // CK14-DAG: [[VALP0]] = bitcast [[ST]]* [[DECL]] to i8*
707
708 // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
709 // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
710 // CK14-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
711 // CK14-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
712 // CK14-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
713 // CK14-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
714 // CK14-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
715 // CK14-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
716 // CK14-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
717
718 // CK14: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
719 sss.foo(123);
720}
721
722// CK14: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
723// CK14: [[ADDR0:%.+]] = alloca [[ST]]*,
724// CK14: [[ADDR1:%.+]] = alloca i[[sz]],
725// CK14: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
726// CK14: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
727// CK14: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
728// CK14-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
729// CK14-64: {{.+}} = load i32, i32* [[CADDR1]],
730// CK14-32: {{.+}} = load i32, i32* [[ADDR1]],
731// CK14: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
732
733#endif
734///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000735// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-64
736// RUN: %clang_cc1 -DCK15 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
737// RUN: %clang_cc1 -fopenmp -fomptargets=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
738// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-32
739// RUN: %clang_cc1 -DCK15 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
740// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000741#ifdef CK15
742
743// CK15: [[ST:%.+]] = type { i32, double, i32* }
744// CK15: [[SIZES:@.+]] = {{.+}}constant [2 x i[[sz:64|32]]] [i{{64|32}} {{24|16}}, i{{64|32}} 4]
745// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000746// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
747// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
748// CK15: [[TYPES:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000749
750// CK15: [[SIZES2:@.+]] = {{.+}}constant [2 x i[[sz]]] [i{{64|32}} {{24|16}}, i{{64|32}} 4]
751// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000752// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
753// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
754// CK15: [[TYPES2:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000755
756template<int x>
757class SSST {
758public:
759 int a;
760 double b;
761 int &r;
762
763 void foo(int c) {
764 #pragma omp target
765 {
766 a += c + x;
767 b += (double)(c + x);
768 r += x;
769 }
770 }
771 template<int y>
772 void bar(int c) {
773 #pragma omp target
774 {
775 a += c + x + y;
776 b += (double)(c + x + y);
777 r += x + y;
778 }
779 }
780
781 SSST(int a, double b, int &r) : a(a), b(b), r(r) {}
782};
783
784// CK15-LABEL: implicit_maps_templated_class
785void implicit_maps_templated_class (int a){
786 SSST<123> ssst(a, (double)a, a);
787
788 // CK15: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
789 // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
790 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
791 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
792
793 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
794 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
795 // CK15-DAG: store i8* [[VALBP0:%.+]], i8** [[BP0]],
796 // CK15-DAG: store i8* [[VALP0:%.+]], i8** [[P0]],
797 // CK15-DAG: [[VALBP0]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
798 // CK15-DAG: [[VALP0]] = bitcast [[ST]]* [[DECL]] to i8*
799
800 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
801 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
802 // CK15-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
803 // CK15-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
804 // CK15-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
805 // CK15-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
806 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
807 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
808 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
809
810 // CK15: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
811 ssst.foo(456);
812
813 // CK15: define {{.*}}void @{{.+}}bar{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
814 // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
815 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
816 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
817
818 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
819 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
820 // CK15-DAG: store i8* [[VALBP0:%.+]], i8** [[BP0]],
821 // CK15-DAG: store i8* [[VALP0:%.+]], i8** [[P0]],
822 // CK15-DAG: [[VALBP0]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
823 // CK15-DAG: [[VALP0]] = bitcast [[ST]]* [[DECL]] to i8*
824
825 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
826 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
827 // CK15-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
828 // CK15-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
829 // CK15-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
830 // CK15-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
831 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
832 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
833 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
834
835 // CK15: call void [[KERNEL2:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
836 ssst.bar<210>(789);
837}
838
839// CK15: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
840// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
841// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
842// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
843// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
844// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
845// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
846// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
847// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
848// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
849
850// CK15: define internal void [[KERNEL2]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
851// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
852// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
853// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
854// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
855// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
856// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
857// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
858// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
859// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
860
861#endif
862///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000863// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-64
864// RUN: %clang_cc1 -DCK16 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
865// RUN: %clang_cc1 -fopenmp -fomptargets=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
866// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-32
867// RUN: %clang_cc1 -DCK16 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
868// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000869#ifdef CK16
870
871// CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
872// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000873// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
874// CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000875
876template<int y>
877int foo(int d) {
878 int res = d;
879 #pragma omp target
880 {
881 res += y;
882 }
883 return res;
884}
885// CK16-LABEL: implicit_maps_templated_function
886void implicit_maps_templated_function (int a){
887 int i = a;
888
889 // CK16: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
890 // CK16-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
891 // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
892 // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
893
894 // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
895 // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
896 // CK16-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
897 // CK16-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
898 // CK16-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
899 // CK16-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
900 // CK16-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
901 // CK16-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
902 // CK16-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
903
904 // CK16: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
905 i = foo<543>(i);
906}
907// CK16: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
908// CK16: [[ADDR:%.+]] = alloca i[[sz]],
909// CK16: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
910// CK16-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
911// CK16-64: {{.+}} = load i32, i32* [[CADDR]],
912// CK16-32: {{.+}} = load i32, i32* [[ADDR]],
913
914#endif
915///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000916// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK17
917// RUN: %clang_cc1 -DCK17 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
918// RUN: %clang_cc1 -fopenmp -fomptargets=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
919// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK17
920// RUN: %clang_cc1 -DCK17 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
921// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK17
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000922#ifdef CK17
923
924// CK17-DAG: [[ST:%.+]] = type { i32, double }
925// CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}]
Samuel Antao6782e942016-05-26 16:48:10 +0000926// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
927// CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 35]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000928
929class SSS {
930public:
931 int a;
932 double b;
933};
934
935// CK17-LABEL: implicit_maps_struct
936void implicit_maps_struct (int a){
937 SSS s = {a, (double)a};
938
939 // CK17-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
940 // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
941 // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
942 // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
943 // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
944 // CK17-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
945 // CK17-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
946 // CK17-DAG: [[VALBP]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
947 // CK17-DAG: [[VALP]] = bitcast [[ST]]* [[DECL]] to i8*
948
949 // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]])
950 #pragma omp target
951 {
952 s.a += 1;
953 s.b += 1.0;
954 }
955}
956
957// CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]])
958// CK17: [[ADDR:%.+]] = alloca [[ST]]*,
959// CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]],
960// CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]],
961// CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0
962#endif
963///==========================================================================///
Samuel Antaoaeb7b532016-03-14 15:57:41 +0000964// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-64
965// RUN: %clang_cc1 -DCK18 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
966// RUN: %clang_cc1 -fopenmp -fomptargets=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
967// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-32
968// RUN: %clang_cc1 -DCK18 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
969// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000970#ifdef CK18
971
972// CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
973// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000974// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
975// CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000976
977template<typename T>
978int foo(T d) {
979 #pragma omp target
980 {
981 d += (T)1;
982 }
983 return d;
984}
985// CK18-LABEL: implicit_maps_template_type_capture
986void implicit_maps_template_type_capture (int a){
987 int i = a;
988
989 // CK18: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
990 // CK18-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
991 // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
992 // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
993
994 // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
995 // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
996 // CK18-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
997 // CK18-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
998 // CK18-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
999 // CK18-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
1000 // CK18-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1001 // CK18-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1002 // CK18-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1003
1004 // CK18: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1005 i = foo(i);
1006}
1007// CK18: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1008// CK18: [[ADDR:%.+]] = alloca i[[sz]],
1009// CK18: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1010// CK18-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1011// CK18-64: {{.+}} = load i32, i32* [[CADDR]],
1012// CK18-32: {{.+}} = load i32, i32* [[ADDR]],
1013
1014#endif
Samuel Antao86ace552016-04-27 22:40:57 +00001015///==========================================================================///
1016// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-64
1017// RUN: %clang_cc1 -DCK19 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1018// RUN: %clang_cc1 -fopenmp -fomptargets=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
1019// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-32
1020// RUN: %clang_cc1 -DCK19 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1021// RUN: %clang_cc1 -fopenmp -fomptargets=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
1022#ifdef CK19
1023
1024// CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001025// CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001026
1027// CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00001028// CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001029
1030// CK19: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001031// CK19: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001032
1033// CK19: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001034// CK19: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001035
1036// CK19: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00001037// CK19: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001038
1039// CK19: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001040// CK19: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001041
Samuel Antao6782e942016-05-26 16:48:10 +00001042// CK19: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001043
Samuel Antao6782e942016-05-26 16:48:10 +00001044// CK19: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001045
1046// CK19: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001047// CK19: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001048
1049// CK19: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00001050// CK19: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001051
1052// CK19: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001053// CK19: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001054
1055// CK19: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001056// CK19: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001057
1058// CK19: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001059// CK19: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001060
Samuel Antao6782e942016-05-26 16:48:10 +00001061// CK19: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001062
Samuel Antao6782e942016-05-26 16:48:10 +00001063// CK19: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001064
1065// CK19: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001066// CK19: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001067
Samuel Antao6782e942016-05-26 16:48:10 +00001068// CK19: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001069
1070// CK19: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001071// CK19: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001072
1073// CK19: [[SIZE18:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001074// CK19: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001075
Samuel Antao6782e942016-05-26 16:48:10 +00001076// CK19: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001077
1078// CK19: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001079// CK19: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001080
Samuel Antao6782e942016-05-26 16:48:10 +00001081// CK19: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001082
1083// CK19: [[SIZE22:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001084// CK19: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001085
1086// CK19: [[SIZE23:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001087// CK19: [[MTYPE23:@.+]] = private {{.*}}constant [1 x i32] [i32 39]
Samuel Antao86ace552016-04-27 22:40:57 +00001088
1089// CK19: [[SIZE24:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 480]
Samuel Antao6782e942016-05-26 16:48:10 +00001090// CK19: [[MTYPE24:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001091
1092// CK19: [[SIZE25:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00001093// CK19: [[MTYPE25:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001094
1095// CK19: [[SIZE26:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 24]
Samuel Antao6782e942016-05-26 16:48:10 +00001096// CK19: [[MTYPE26:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001097
1098// CK19: [[SIZE27:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001099// CK19: [[MTYPE27:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001100
1101// CK19: [[SIZE28:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00001102// CK19: [[MTYPE28:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001103
1104// CK19: [[SIZE29:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001105// CK19: [[MTYPE29:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001106
Samuel Antao6782e942016-05-26 16:48:10 +00001107// CK19: [[MTYPE30:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001108
1109// CK19: [[SIZE31:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 40]
Samuel Antao6782e942016-05-26 16:48:10 +00001110// CK19: [[MTYPE31:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001111
1112// CK19: [[SIZE32:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001113// CK19: [[MTYPE32:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001114
1115// CK19: [[SIZE33:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001116// CK19: [[MTYPE33:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001117
1118// CK19: [[SIZE34:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001119// CK19: [[MTYPE34:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001120
Samuel Antao6782e942016-05-26 16:48:10 +00001121// CK19: [[MTYPE35:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001122
1123// CK19: [[SIZE36:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 208]
Samuel Antao6782e942016-05-26 16:48:10 +00001124// CK19: [[MTYPE36:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001125
Samuel Antao6782e942016-05-26 16:48:10 +00001126// CK19: [[MTYPE37:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001127
Samuel Antao6782e942016-05-26 16:48:10 +00001128// CK19: [[MTYPE38:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001129
Samuel Antao6782e942016-05-26 16:48:10 +00001130// CK19: [[MTYPE39:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001131
Samuel Antao6782e942016-05-26 16:48:10 +00001132// CK19: [[MTYPE40:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001133
1134// CK19: [[SIZE41:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 208]
Samuel Antao6782e942016-05-26 16:48:10 +00001135// CK19: [[MTYPE41:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001136
1137// CK19: [[SIZE42:@.+]] = private {{.*}}constant [3 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 104]
Samuel Antao6782e942016-05-26 16:48:10 +00001138// CK19: [[MTYPE42:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001139
Samuel Antao6782e942016-05-26 16:48:10 +00001140// CK19: [[MTYPE43:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001141
1142// CK19-LABEL: explicit_maps_single
1143void explicit_maps_single (int ii){
1144 // Map of a scalar.
1145 int a = ii;
1146
1147 // Region 00
1148 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
1149 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1150 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1151
1152 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1153 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1154 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1155 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1156 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
1157 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
1158
1159 // CK19: call void [[CALL00:@.+]](i32* {{[^,]+}})
1160 #pragma omp target map(alloc:a)
1161 {
1162 ++a;
1163 }
1164
1165 // Map of an array.
1166 int arra[100];
1167
1168 // Region 01
1169 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
1170 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1171 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1172
1173 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1174 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1175 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1176 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1177 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1178 // CK19-DAG: [[CPVAL0]] = bitcast [100 x i32]* [[VAR0]] to i8*
1179
1180 // CK19: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
1181 #pragma omp target map(to:arra)
1182 {
1183 arra[50]++;
1184 }
1185
1186 // Region 02
1187 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
1188 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1189 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1190
1191 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1192 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1193 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1194 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1195 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1196 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1197 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20
1198
1199 // CK19: call void [[CALL02:@.+]]([100 x i32]* {{[^,]+}})
1200 #pragma omp target map(from:arra[20:60])
1201 {
1202 arra[50]++;
1203 }
1204
1205 // Region 03
1206 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
1207 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1208 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1209
1210 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1211 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1212 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1213 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1214 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1215 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1216 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1217
1218 // CK19: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
1219 #pragma omp target map(tofrom:arra[:60])
1220 {
1221 arra[50]++;
1222 }
1223
1224 // Region 04
1225 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
1226 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1227 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1228
1229 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1230 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1231 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1232 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1233 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1234 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1235 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1236
1237 // CK19: call void [[CALL04:@.+]]([100 x i32]* {{[^,]+}})
1238 #pragma omp target map(alloc:arra[:])
1239 {
1240 arra[50]++;
1241 }
1242
1243 // Region 05
1244 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
1245 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1246 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1247
1248 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1249 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1250 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1251 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1252 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1253 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1254 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 15
1255
1256 // CK19: call void [[CALL05:@.+]]([100 x i32]* {{[^,]+}})
1257 #pragma omp target map(to:arra[15])
1258 {
1259 arra[15]++;
1260 }
1261
1262 // Region 06
1263 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
1264 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1265 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1266 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1267
1268 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1269 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1270 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1271 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1272 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1273 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1274 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1275 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1276 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1277 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1278
1279 // CK19: call void [[CALL06:@.+]]([100 x i32]* {{[^,]+}})
1280 #pragma omp target map(tofrom:arra[ii:ii+23])
1281 {
1282 arra[50]++;
1283 }
1284
1285 // Region 07
1286 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
1287 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1288 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1289 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1290
1291 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1292 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1293 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1294 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1295 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1296 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1297 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1298 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1299 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1300 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1301
1302 // CK19: call void [[CALL07:@.+]]([100 x i32]* {{[^,]+}})
1303 #pragma omp target map(alloc:arra[:ii])
1304 {
1305 arra[50]++;
1306 }
1307
1308 // Region 08
1309 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
1310 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1311 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1312
1313 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1314 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1315 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1316 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1317 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1318 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1319 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1320
1321 // CK19: call void [[CALL08:@.+]]([100 x i32]* {{[^,]+}})
1322 #pragma omp target map(tofrom:arra[ii])
1323 {
1324 arra[15]++;
1325 }
1326
1327 // Map of a pointer.
1328 int *pa;
1329
1330 // Region 09
1331 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
1332 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1333 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1334
1335 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1336 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1337 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1338 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1339 // CK19-DAG: [[CBPVAL0]] = bitcast i32** [[VAR0:%.+]] to i8*
1340 // CK19-DAG: [[CPVAL0]] = bitcast i32** [[VAR0]] to i8*
1341
1342 // CK19: call void [[CALL09:@.+]](i32** {{[^,]+}})
1343 #pragma omp target map(from:pa)
1344 {
1345 pa[50]++;
1346 }
1347
1348 // Region 10
1349 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
1350 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1351 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1352
1353 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1354 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1355 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1356 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1357 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1358 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1359 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1360 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 20
1361 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1362
1363 // CK19: call void [[CALL10:@.+]](i32* {{[^,]+}})
1364 #pragma omp target map(tofrom:pa[20:60])
1365 {
1366 pa[50]++;
1367 }
1368
1369 // Region 11
1370 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
1371 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1372 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1373
1374 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1375 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1376 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1377 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1378 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1379 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1380 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1381 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1382 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1383
1384 // CK19: call void [[CALL11:@.+]](i32* {{[^,]+}})
1385 #pragma omp target map(alloc:pa[:60])
1386 {
1387 pa[50]++;
1388 }
1389
1390 // Region 12
1391 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
1392 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1393 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1394
1395 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1396 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1397 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1398 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1399 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1400 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1401 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1402 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 15
1403 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1404
1405 // CK19: call void [[CALL12:@.+]](i32* {{[^,]+}})
1406 #pragma omp target map(to:pa[15])
1407 {
1408 pa[15]++;
1409 }
1410
1411 // Region 13
1412 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
1413 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1414 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1415 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1416
1417 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1418 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1419 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1420 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1421 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1422 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1423 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1424 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1425 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1426 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1427 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1428 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1429
1430 // CK19: call void [[CALL13:@.+]](i32* {{[^,]+}})
1431 #pragma omp target map(alloc:pa[ii-23:ii])
1432 {
1433 pa[50]++;
1434 }
1435
1436 // Region 14
1437 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
1438 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1439 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1440 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1441
1442 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1443 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1444 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1445 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1446 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1447 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1448 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1449 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1450 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1451 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1452 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1453 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1454
1455 // CK19: call void [[CALL14:@.+]](i32* {{[^,]+}})
1456 #pragma omp target map(to:pa[:ii])
1457 {
1458 pa[50]++;
1459 }
1460
1461 // Region 15
1462 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
1463 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1464 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1465
1466 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1467 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1468 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1469 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1470 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1471 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1472 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1473 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1474 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1475
1476 // CK19: call void [[CALL15:@.+]](i32* {{[^,]+}})
1477 #pragma omp target map(from:pa[ii+12])
1478 {
1479 pa[15]++;
1480 }
1481
1482 // Map of a variable-size array.
1483 int va[ii];
1484
1485 // Region 16
1486 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE16]]{{.+}})
1487 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1488 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1489 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1490
1491 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1492 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1493 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1494 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1495 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1496 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
1497 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1498 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1499
1500 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1501 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1502 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1503 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1504 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1505 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
1506 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1507 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[VAR1]] to i8*
1508 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1509
1510 // CK19: call void [[CALL16:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1511 #pragma omp target map(to:va)
1512 {
1513 va[50]++;
1514 }
1515
1516 // Region 17
1517 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
1518 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1519 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
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: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1524 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1525 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1526 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1527
1528 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1529 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1530 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1531 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1532 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1533 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1534 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 20
1535
1536 // CK19: call void [[CALL17:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1537 #pragma omp target map(from:va[20:60])
1538 {
1539 va[50]++;
1540 }
1541
1542 // Region 18
1543 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE18]]{{.+}})
1544 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1545 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1546
1547 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1548 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1549 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1550 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1551 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1552 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1553
1554 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1555 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1556 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1557 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1558 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1559 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1560 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1561
1562 // CK19: call void [[CALL18:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1563 #pragma omp target map(tofrom:va[:60])
1564 {
1565 va[50]++;
1566 }
1567
1568 // Region 19
1569 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
1570 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1571 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1572 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1573
1574 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1575 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1576 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1577 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1578 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1579 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
1580 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1581 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1582
1583 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1584 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1585 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1586 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1587 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1588 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
1589 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1590 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1591 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1592 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1593
1594 // CK19: call void [[CALL19:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1595 #pragma omp target map(alloc:va[:])
1596 {
1597 va[50]++;
1598 }
1599
1600 // Region 20
1601 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
1602 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1603 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1604
1605 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1606 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1607 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1608 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1609 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1610 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1611
1612 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1613 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1614 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1615 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1616 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1617 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1618 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 15
1619
1620 // CK19: call void [[CALL20:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1621 #pragma omp target map(to:va[15])
1622 {
1623 va[15]++;
1624 }
1625
1626 // Region 21
1627 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
1628 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1629 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1630 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1631
1632 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1633 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1634 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1635 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1636 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1637 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
1638 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1639 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1640
1641 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1642 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1643 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1644 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1645 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1646 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
1647 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1648 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1649 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1650 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1651
1652 // CK19: call void [[CALL21:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1653 #pragma omp target map(tofrom:va[ii:ii+23])
1654 {
1655 va[50]++;
1656 }
1657
1658 // Region 22
1659 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE22]]{{.+}})
1660 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1661 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1662
1663 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1664 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1665 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1666 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1667 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1668 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1669
1670 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1671 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1672 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1673 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1674 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1675 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1676 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1677
1678 // CK19: call void [[CALL22:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1679 #pragma omp target map(tofrom:va[ii])
1680 {
1681 va[15]++;
1682 }
1683
1684 // Always.
1685 // Region 23
1686 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE23]]{{.+}})
1687 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1688 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1689
1690 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1691 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1692 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1693 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1694 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
1695 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
1696
1697 // CK19: call void [[CALL23:@.+]](i32* {{[^,]+}})
1698 #pragma omp target map(always, tofrom: a)
1699 {
1700 a++;
1701 }
1702
1703 // Multidimensional arrays.
1704 int marr[4][5][6];
1705 int ***mptr;
1706
1707 // Region 24
1708 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE24]]{{.+}})
1709 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1710 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1711
1712 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1713 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1714 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1715 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1716 // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1717 // CK19-DAG: [[CPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0]] to i8*
1718
1719 // CK19: call void [[CALL24:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1720 #pragma omp target map(tofrom: marr)
1721 {
1722 marr[1][2][3]++;
1723 }
1724
1725 // Region 25
1726 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE25]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE25]]{{.+}})
1727 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1728 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1729
1730 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1731 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1732 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1733 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1734 // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1735 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1736 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 2
1737 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1738 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1739
1740 // CK19: call void [[CALL25:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1741 #pragma omp target map(tofrom: marr[1][2][2:4])
1742 {
1743 marr[1][2][3]++;
1744 }
1745
1746 // Region 26
1747 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE26]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE26]]{{.+}})
1748 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1749 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1750
1751 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1752 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1753 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1754 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1755 // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1756 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1757 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 0
1758 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1759 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1760
1761 // CK19: call void [[CALL26:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1762 #pragma omp target map(tofrom: marr[1][2][:])
1763 {
1764 marr[1][2][3]++;
1765 }
1766
1767 // Region 27
1768 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE27]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE27]]{{.+}})
1769 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1770 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1771
1772 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1773 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1774 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1775 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1776 // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1777 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1778 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 3
1779 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1780 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1781
1782 // CK19: call void [[CALL27:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1783 #pragma omp target map(tofrom: marr[1][2][3])
1784 {
1785 marr[1][2][3]++;
1786 }
1787
1788 // Region 28
1789 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE28]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE28]]{{.+}})
1790 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1791 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1792
1793 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1794 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1795 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1796 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1797 // CK19-DAG: [[CBPVAL0]] = bitcast i32*** [[VAR0:%.+]] to i8*
1798 // CK19-DAG: [[CPVAL0]] = bitcast i32*** [[SEC0:%.+]] to i8*
1799 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1800 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1801 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1802
1803 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1804 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1805 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1806 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1807 // CK19-DAG: [[CBPVAL1]] = bitcast i32*** [[SEC0]] to i8*
1808 // CK19-DAG: [[CPVAL1]] = bitcast i32** [[SEC1:%.+]] to i8*
1809 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1810 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1811 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1812 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1813
1814 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1815 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1816 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1817 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1818 // CK19-DAG: [[CBPVAL2]] = bitcast i32** [[SEC1]] to i8*
1819 // CK19-DAG: [[CPVAL2]] = bitcast i32* [[SEC2:%.+]] to i8*
1820 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 2
1821 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1822 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1823 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1824 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1825 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1826
1827 // CK19: call void [[CALL28:@.+]](i32*** {{[^,]+}})
1828 #pragma omp target map(tofrom: mptr[1][2][2:4])
1829 {
1830 mptr[1][2][3]++;
1831 }
1832
1833 // Region 29
1834 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE29]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE29]]{{.+}})
1835 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1836 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1837
1838 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1839 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1840 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1841 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1842 // CK19-DAG: [[CBPVAL0]] = bitcast i32*** [[VAR0:%.+]] to i8*
1843 // CK19-DAG: [[CPVAL0]] = bitcast i32*** [[SEC0:%.+]] to i8*
1844 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1845 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1846 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1847
1848 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1849 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1850 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1851 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1852 // CK19-DAG: [[CBPVAL1]] = bitcast i32*** [[SEC0]] to i8*
1853 // CK19-DAG: [[CPVAL1]] = bitcast i32** [[SEC1:%.+]] to i8*
1854 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1855 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1856 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1857 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1858
1859 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1860 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1861 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1862 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1863 // CK19-DAG: [[CBPVAL2]] = bitcast i32** [[SEC1]] to i8*
1864 // CK19-DAG: [[CPVAL2]] = bitcast i32* [[SEC2:%.+]] to i8*
1865 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 3
1866 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1867 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1868 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1869 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1870 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1871
1872 // CK19: call void [[CALL29:@.+]](i32*** {{[^,]+}})
1873 #pragma omp target map(tofrom: mptr[1][2][3])
1874 {
1875 mptr[1][2][3]++;
1876 }
1877
1878 // Multidimensional VLA.
1879 double mva[23][ii][ii+5];
1880
1881 // Region 30
1882 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE30]]{{.+}})
1883 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1884 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1885 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1886 //
1887 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1888 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1889 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1890 // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[BP0]]
1891 // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[P0]]
1892 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
1893 //
1894 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1895 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1896 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1897 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1898 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1899 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
1900 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
1901 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
1902 // CK19-64-DAG: [[VAR1]] = zext i32 %{{[^,]+}} to i64
1903 // CK19-64-DAG: [[VAR11]] = zext i32 %{{[^,]+}} to i64
1904 //
1905 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1906 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1907 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
1908 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1909 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1910 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S2]]
1911 // CK19-DAG: [[CBPVAL2]] = inttoptr i[[Z]] [[VAR2:%.+]] to i8*
1912 // CK19-DAG: [[CPVAL2]] = inttoptr i[[Z]] [[VAR22:%.+]] to i8*
1913 // CK19-64-DAG: [[VAR2]] = zext i32 %{{[^,]+}} to i64
1914 // CK19-64-DAG: [[VAR22]] = zext i32 %{{[^,]+}} to i64
1915 //
1916 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1917 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
1918 // CK19-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
1919 // CK19-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
1920 // CK19-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
1921 // CK19-DAG: store i[[Z]] [[CSVAL3:%[^,]+]], i[[Z]]* [[S3]]
1922 // CK19-DAG: [[CBPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
1923 // CK19-DAG: [[CPVAL3]] = bitcast double* [[VAR3]] to i8*
1924 // CK19-DAG: [[CSVAL3]] = mul nuw i[[Z]] %{{[^,]+}}, {{8|4}}
1925
1926 // CK19: call void [[CALL30:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
1927 #pragma omp target map(tofrom: mva)
1928 {
1929 mva[1][2][3]++;
1930 }
1931
1932 // Region 31
1933 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE31]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE31]]{{.+}})
1934 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1935 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1936 //
1937 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1938 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1939 // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[BP0]]
1940 // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[P0]]
1941 //
1942 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1943 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1944 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1945 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1946 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
1947 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
1948 //
1949 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1950 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1951 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1952 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1953 // CK19-DAG: [[CBPVAL2]] = inttoptr i[[Z]] [[VAR2:%.+]] to i8*
1954 // CK19-DAG: [[CPVAL2]] = inttoptr i[[Z]] [[VAR22:%.+]] to i8*
1955 //
1956 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1957 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
1958 // CK19-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
1959 // CK19-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
1960 // CK19-DAG: [[CBPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
1961 // CK19-DAG: [[CPVAL3]] = bitcast double* [[SEC3:%.+]] to i8*
1962 // CK19-DAG: [[SEC3]] = getelementptr {{.*}}double* [[SEC33:%.+]], i[[Z]] 0
1963 // CK19-DAG: [[SEC33]] = getelementptr {{.*}}double* [[SEC333:%.+]], i[[Z]] [[IDX3:%.+]]
1964 // CK19-DAG: [[IDX3]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}}
1965 // CK19-DAG: [[SEC333]] = getelementptr {{.*}}double* [[VAR3]], i[[Z]] [[IDX33:%.+]]
1966 // CK19-DAG: [[IDX33]] = mul nsw i[[Z]] 1, %{{[^,]+}}
1967
1968 // CK19: call void [[CALL31:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
1969 #pragma omp target map(tofrom: mva[1][ii-2][:5])
1970 {
1971 mva[1][2][3]++;
1972 }
1973
1974 // Multidimensional array sections.
1975 double marras[11][12][13];
1976 double mvlaas[11][ii][13];
1977 double ***mptras;
1978
1979 // Region 32
1980 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE32]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE32]]{{.+}})
1981 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1982 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1983
1984 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1985 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1986 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1987 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1988 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
1989 // CK19-DAG: [[CPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0]] to i8*
1990
1991 // CK19: call void [[CALL32:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
1992 #pragma omp target map(marras)
1993 {
1994 marras[1][2][3]++;
1995 }
1996
1997 // Region 33
1998 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE33]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE33]]{{.+}})
1999 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2000 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2001
2002 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2003 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2004 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2005 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2006 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2007 // CK19-DAG: [[CPVAL0]] = bitcast [12 x [13 x double]]* [[SEC0:%.+]] to i8*
2008 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2009
2010 // CK19: call void [[CALL33:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2011 #pragma omp target map(marras[:])
2012 {
2013 marras[1][2][3]++;
2014 }
2015
2016 // Region 34
2017 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE34]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE34]]{{.+}})
2018 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2019 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2020
2021 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2022 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2023 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2024 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2025 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2026 // CK19-DAG: [[CPVAL0]] = bitcast [12 x [13 x double]]* [[SEC0:%.+]] to i8*
2027 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2028
2029 // CK19: call void [[CALL34:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2030 #pragma omp target map(marras[:][:][:])
2031 {
2032 marras[1][2][3]++;
2033 }
2034
2035 // Region 35
2036 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE35]]{{.+}})
2037 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2038 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2039 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2040 //
2041 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2042 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2043 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2044
2045 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2046 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2047 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
2048 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2049 // CK19-DAG: [[CPVAL0]] = bitcast [13 x double]* [[SEC0:%.+]] to i8*
2050 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2051 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2052 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2053
2054 // CK19: call void [[CALL35:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2055 #pragma omp target map(marras[1][:ii][:])
2056 {
2057 marras[1][2][3]++;
2058 }
2059
2060 // Region 36
2061 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE36]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE36]]{{.+}})
2062 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2063 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2064
2065 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2066 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2067 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2068 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2069 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2070 // CK19-DAG: [[CPVAL0]] = bitcast [13 x double]* [[SEC0:%.+]] to i8*
2071 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i{{.+}} 0
2072 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 0
2073 // CK19-DAG: [[SEC000]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2074
2075 // CK19: call void [[CALL36:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2076 #pragma omp target map(marras[:1][:2][:13])
2077 {
2078 marras[1][2][3]++;
2079 }
2080
2081 // Region 37
2082 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE37]]{{.+}})
2083 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2084 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2085 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2086 //
2087 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2088 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2089 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2090 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2091 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2092 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2093 //
2094 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2095 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2096 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2097 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2098 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2099 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2100 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2101 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2102 //
2103 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2104 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2105 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2106 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2107 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2108 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2109 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2110 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[VAR2]] to i8*
2111 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2112
2113 // CK19: call void [[CALL37:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2114 #pragma omp target map(mvlaas)
2115 {
2116 mvlaas[1][2][3]++;
2117 }
2118
2119 // Region 38
2120 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE38]]{{.+}})
2121 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2122 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2123 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2124 //
2125 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2126 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2127 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2128 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2129 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2130 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2131 //
2132 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2133 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2134 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2135 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2136 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2137 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2138 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2139 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2140 //
2141 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2142 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2143 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2144 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2145 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2146 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2147 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2148 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2149 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2150 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2151 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2152
2153 // CK19: call void [[CALL38:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2154 #pragma omp target map(mvlaas[:])
2155 {
2156 mvlaas[1][2][3]++;
2157 }
2158
2159 // Region 39
2160 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE39]]{{.+}})
2161 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2162 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2163 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2164 //
2165 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2166 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2167 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2168 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2169 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2170 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2171 //
2172 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2173 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2174 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2175 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2176 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2177 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2178 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2179 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2180 //
2181 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2182 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2183 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2184 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2185 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2186 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2187 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2188 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2189 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2190 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2191 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2192
2193 // CK19: call void [[CALL39:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2194 #pragma omp target map(mvlaas[:][:][:])
2195 {
2196 mvlaas[1][2][3]++;
2197 }
2198
2199 // Region 40
2200 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE40]]{{.+}})
2201 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2202 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2203 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2204 //
2205 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2206 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2207 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2208 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2209 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2210 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2211 //
2212 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2213 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2214 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2215 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2216 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2217 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2218 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2219 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2220 //
2221 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2222 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2223 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2224 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2225 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2226 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2227 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2228 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2229 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2230 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2231 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2232
2233 // CK19: call void [[CALL40:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2234 #pragma omp target map(mvlaas[1][:ii][:])
2235 {
2236 mvlaas[1][2][3]++;
2237 }
2238
2239 // Region 41
2240 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE41]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE41]]{{.+}})
2241 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2242 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2243 //
2244 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2245 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2246 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2247 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2248 //
2249 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2250 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2251 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2252 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2253 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2254 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2255 //
2256 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2257 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2258 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2259 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2260 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2261 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2262 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2263 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2264 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2265
2266 // CK19: call void [[CALL41:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2267 #pragma omp target map(mvlaas[:1][:2][:13])
2268 {
2269 mvlaas[1][2][3]++;
2270 }
2271
2272 // Region 42
2273 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE42]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE42]]{{.+}})
2274 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2275 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2276
2277 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2278 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2279 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2280 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2281 // CK19-DAG: [[CBPVAL0]] = bitcast double*** [[VAR0:%.+]] to i8*
2282 // CK19-DAG: [[CPVAL0]] = bitcast double*** [[SEC0:%.+]] to i8*
2283 // CK19-DAG: [[VAR0]] = load double***, double**** [[PTR:%[^,]+]],
2284 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}double*** [[SEC00:[^,]+]], i{{.+}} 0
2285 // CK19-DAG: [[SEC00]] = load double***, double**** [[PTR]],
2286
2287 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2288 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2289 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2290 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2291 // CK19-DAG: [[CBPVAL1]] = bitcast double*** [[SEC0]] to i8*
2292 // CK19-DAG: [[CPVAL1]] = bitcast double** [[SEC1:%.+]] to i8*
2293 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}double** [[SEC11:[^,]+]], i{{.+}} 2
2294 // CK19-DAG: [[SEC11]] = load double**, double*** [[SEC111:%[^,]+]],
2295 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}double*** [[SEC1111:[^,]+]], i{{.+}} 0
2296 // CK19-DAG: [[SEC1111]] = load double***, double**** [[PTR]],
2297
2298 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2299 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2300 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2301 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2302 // CK19-DAG: [[CBPVAL2]] = bitcast double** [[SEC1]] to i8*
2303 // CK19-DAG: [[CPVAL2]] = bitcast double* [[SEC2:%.+]] to i8*
2304 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}double* [[SEC22:[^,]+]], i{{.+}} 0
2305 // CK19-DAG: [[SEC22]] = load double*, double** [[SEC222:%[^,]+]],
2306 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}double** [[SEC2222:[^,]+]], i{{.+}} 2
2307 // CK19-DAG: [[SEC2222]] = load double**, double*** [[SEC22222:%[^,]+]],
2308 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}double*** [[SEC222222:[^,]+]], i{{.+}} 0
2309 // CK19-DAG: [[SEC222222]] = load double***, double**** [[PTR]],
2310
2311 // CK19: call void [[CALL42:@.+]](double*** {{[^,]+}})
2312 #pragma omp target map(mptras[:1][2][:13])
2313 {
2314 mptras[1][2][3]++;
2315 }
2316
2317 // Region 43 - the memory is not contiguous for this map - will map the whole last dimension.
2318 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE43]]{{.+}})
2319 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2320 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2321 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2322 //
2323 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2324 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2325 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2326
2327 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2328 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2329 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
2330 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2331 // CK19-DAG: [[CPVAL0]] = bitcast [13 x double]* [[SEC0:%.+]] to i8*
2332 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2333 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2334 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2335
2336 // CK19: call void [[CALL43:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2337 #pragma omp target map(marras[1][:ii][1:])
2338 {
2339 marras[1][2][3]++;
2340 }
2341
2342}
2343
2344// CK19: define {{.+}}[[CALL00]]
2345// CK19: define {{.+}}[[CALL01]]
2346// CK19: define {{.+}}[[CALL02]]
2347// CK19: define {{.+}}[[CALL03]]
2348// CK19: define {{.+}}[[CALL04]]
2349// CK19: define {{.+}}[[CALL05]]
2350// CK19: define {{.+}}[[CALL06]]
2351// CK19: define {{.+}}[[CALL07]]
2352// CK19: define {{.+}}[[CALL08]]
2353// CK19: define {{.+}}[[CALL09]]
2354// CK19: define {{.+}}[[CALL10]]
2355// CK19: define {{.+}}[[CALL11]]
2356// CK19: define {{.+}}[[CALL12]]
2357// CK19: define {{.+}}[[CALL13]]
2358// CK19: define {{.+}}[[CALL14]]
2359// CK19: define {{.+}}[[CALL15]]
2360// CK19: define {{.+}}[[CALL16]]
2361// CK19: define {{.+}}[[CALL17]]
2362// CK19: define {{.+}}[[CALL18]]
2363// CK19: define {{.+}}[[CALL19]]
2364// CK19: define {{.+}}[[CALL20]]
2365// CK19: define {{.+}}[[CALL21]]
2366// CK19: define {{.+}}[[CALL22]]
2367// CK19: define {{.+}}[[CALL23]]
2368// CK19: define {{.+}}[[CALL24]]
2369// CK19: define {{.+}}[[CALL25]]
2370// CK19: define {{.+}}[[CALL26]]
2371// CK19: define {{.+}}[[CALL27]]
2372// CK19: define {{.+}}[[CALL28]]
2373// CK19: define {{.+}}[[CALL29]]
2374// CK19: define {{.+}}[[CALL30]]
2375// CK19: define {{.+}}[[CALL31]]
2376// CK19: define {{.+}}[[CALL32]]
2377// CK19: define {{.+}}[[CALL33]]
2378// CK19: define {{.+}}[[CALL34]]
2379// CK19: define {{.+}}[[CALL35]]
2380// CK19: define {{.+}}[[CALL36]]
2381// CK19: define {{.+}}[[CALL37]]
2382// CK19: define {{.+}}[[CALL38]]
2383// CK19: define {{.+}}[[CALL39]]
2384// CK19: define {{.+}}[[CALL40]]
2385// CK19: define {{.+}}[[CALL41]]
2386// CK19: define {{.+}}[[CALL42]]
2387// CK19: define {{.+}}[[CALL43]]
2388
2389#endif
2390///==========================================================================///
2391// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-64
2392// RUN: %clang_cc1 -DCK20 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2393// RUN: %clang_cc1 -fopenmp -fomptargets=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
2394// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-32
2395// RUN: %clang_cc1 -DCK20 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2396// RUN: %clang_cc1 -fopenmp -fomptargets=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
2397#ifdef CK20
2398
2399// CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002400// CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002401
2402// CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002403// CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002404
2405// CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002406// CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002407
2408// CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 12]
Samuel Antao6782e942016-05-26 16:48:10 +00002409// CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002410
2411// CK20-LABEL: explicit_maps_references_and_function_args
2412void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){
2413
2414 int &aa = a;
2415 float &bb = b;
2416 int (&cc)[10] = c;
2417 float *&dd = d;
2418
2419 // Region 00
2420 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2421 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2422 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2423
2424 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2425 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2426 // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2427 // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2428 // CK20-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
2429 // CK20-DAG: [[CPVAL0]] = bitcast i32* [[RVAR00:%.+]] to i8*
2430 // CK20-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2431 // CK20-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2432
2433 // CK20: call void [[CALL00:@.+]](i32* {{[^,]+}})
2434 #pragma omp target map(to:aa)
2435 {
2436 aa += 1;
2437 }
2438
2439 // Region 01
2440 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2441 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2442 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2443
2444 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2445 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2446 // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2447 // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2448 // CK20-DAG: [[CBPVAL0]] = bitcast [10 x i32]* [[RVAR0:%.+]] to i8*
2449 // CK20-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2450 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0
2451 // CK20-DAG: [[RVAR0]] = load [10 x i32]*, [10 x i32]** [[VAR0:%[^,]+]]
2452 // CK20-DAG: [[RVAR00]] = load [10 x i32]*, [10 x i32]** [[VAR0]]
2453
2454 // CK20: call void [[CALL01:@.+]]([10 x i32]* {{[^,]+}})
2455 #pragma omp target map(to:cc[:5])
2456 {
2457 cc[3] += 1;
2458 }
2459
2460 // Region 02
2461 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2462 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2463 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2464
2465 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2466 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2467 // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2468 // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2469 // CK20-DAG: [[CBPVAL0]] = bitcast float* [[VAR0:%.+]] to i8*
2470 // CK20-DAG: [[CPVAL0]] = bitcast float* [[VAR0]] to i8*
2471
2472 // CK20: call void [[CALL02:@.+]](float* {{[^,]+}})
2473 #pragma omp target map(from:b)
2474 {
2475 b += 1.0f;
2476 }
2477
2478 // Region 03
2479 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2480 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2481 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2482
2483 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2484 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2485 // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2486 // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2487 // CK20-DAG: [[CBPVAL0]] = bitcast float* [[RVAR0:%.+]] to i8*
2488 // CK20-DAG: [[CPVAL0]] = bitcast float* [[SEC0:%.+]] to i8*
2489 // CK20-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
2490 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
2491 // CK20-DAG: [[RVAR00]] = load float*, float** [[VAR0]]
2492
2493 // CK20: call void [[CALL03:@.+]](float* {{[^,]+}})
2494 #pragma omp target map(from:d[2:3])
2495 {
2496 d[2] += 1.0f;
2497 }
2498}
2499
2500// CK20: define {{.+}}[[CALL00]]
2501// CK20: define {{.+}}[[CALL01]]
2502// CK20: define {{.+}}[[CALL02]]
2503// CK20: define {{.+}}[[CALL03]]
2504
2505#endif
2506///==========================================================================///
2507// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-64
2508// RUN: %clang_cc1 -DCK21 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2509// RUN: %clang_cc1 -fopenmp -fomptargets=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
2510// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-32
2511// RUN: %clang_cc1 -DCK21 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2512// RUN: %clang_cc1 -fopenmp -fomptargets=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
2513#ifdef CK21
2514// CK21: [[ST:%.+]] = type { i32, i32, float* }
2515
2516// CK21: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002517// CK21: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002518
2519// CK21: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
Samuel Antao6782e942016-05-26 16:48:10 +00002520// CK21: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002521
2522// CK21: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 500]
Samuel Antao6782e942016-05-26 16:48:10 +00002523// CK21: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 34, i32 18]
Samuel Antao86ace552016-04-27 22:40:57 +00002524
2525// CK21: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
Samuel Antao6782e942016-05-26 16:48:10 +00002526// CK21: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002527
2528// CK21: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002529// CK21: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002530
2531// CK21: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] 4, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002532// CK21: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 3]
Samuel Antao86ace552016-04-27 22:40:57 +00002533
2534// CK21-LABEL: explicit_maps_template_args_and_members
2535
2536template <int X, typename T>
2537struct CC {
2538 T A;
2539 int A2;
2540 float *B;
2541
2542 int foo(T arg) {
2543 float la[X];
2544 T *lb;
2545
2546 // Region 00
2547 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2548 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2549 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2550
2551 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2552 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2553 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2554 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2555 // CK21-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
2556 // CK21-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2557 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
2558
2559 // CK21: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
2560 #pragma omp target map(A)
2561 {
2562 A += 1;
2563 }
2564
2565 // Region 01
2566 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2567 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2568 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2569
2570 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2571 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2572 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2573 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2574 // CK21-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
2575 // CK21-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2576 // CK21-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2577 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
2578 // CK21-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2579
2580 // CK21: call void [[CALL01:@.+]](i32* {{[^,]+}})
2581 #pragma omp target map(lb[:X])
2582 {
2583 lb[4] += 1;
2584 }
2585
2586 // Region 02
2587 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
2588 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2589 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2590
2591 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2592 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2593 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2594 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2595 // CK21-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
2596 // CK21-DAG: [[CPVAL0]] = bitcast float** [[SEC0:%.+]] to i8*
2597 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2598
2599 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2600 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2601 // CK21-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2602 // CK21-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2603 // CK21-DAG: [[CBPVAL1]] = bitcast float** [[SEC0]] to i8*
2604 // CK21-DAG: [[CPVAL1]] = bitcast float* [[SEC1:%.+]] to i8*
2605 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}float* [[RVAR1:%[^,]+]], i{{.+}} 123
2606 // CK21-DAG: [[RVAR1]] = load float*, float** [[SEC1_:%[^,]+]]
2607 // CK21-DAG: [[SEC1_]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2608
2609 // CK21: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}})
2610 #pragma omp target map(from:B[X:X+2])
2611 {
2612 B[2] += 1.0f;
2613 }
2614
2615 // Region 03
2616 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2617 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2618 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2619
2620 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2621 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2622 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2623 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2624 // CK21-DAG: [[CBPVAL0]] = bitcast [123 x float]* [[VAR0:%.+]] to i8*
2625 // CK21-DAG: [[CPVAL0]] = bitcast [123 x float]* [[VAR0]] to i8*
2626
2627 // CK21: call void [[CALL03:@.+]]([123 x float]* {{[^,]+}})
2628 #pragma omp target map(from:la)
2629 {
2630 la[3] += 1.0f;
2631 }
2632
2633 // Region 04
2634 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2635 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2636 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2637
2638 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2639 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2640 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2641 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2642 // CK21-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
2643 // CK21-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
2644
2645 // CK21: call void [[CALL04:@.+]](i32* {{[^,]+}})
2646 #pragma omp target map(from:arg)
2647 {
2648 arg +=1;
2649 }
2650
2651 // Make sure the extra flag is passed to the second map.
2652 // Region 05
2653 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
2654 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2655 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2656
2657 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2658 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2659 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2660 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2661 // CK21-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
2662 // CK21-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2663 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2664
2665 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2666 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2667 // CK21-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2668 // CK21-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2669 // CK21-DAG: [[CBPVAL1]] = bitcast [[ST]]* [[VAR1:%.+]] to i8*
2670 // CK21-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
2671 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2672
2673 // CK21: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2674 #pragma omp target map(A, A2)
2675 {
2676 A += 1;
2677 A2 += 1;
2678 }
2679 return A;
2680 }
2681};
2682
2683int explicit_maps_template_args_and_members(int a){
2684 CC<123,int> c;
2685 return c.foo(a);
2686}
2687
2688// CK21: define {{.+}}[[CALL00]]
2689// CK21: define {{.+}}[[CALL01]]
2690// CK21: define {{.+}}[[CALL02]]
2691// CK21: define {{.+}}[[CALL03]]
2692// CK21: define {{.+}}[[CALL04]]
2693// CK21: define {{.+}}[[CALL05]]
2694#endif
2695///==========================================================================///
2696// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-64
2697// RUN: %clang_cc1 -DCK22 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2698// RUN: %clang_cc1 -fopenmp -fomptargets=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
2699// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-32
2700// RUN: %clang_cc1 -DCK22 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2701// RUN: %clang_cc1 -fopenmp -fomptargets=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
2702#ifdef CK22
2703
2704// CK22-DAG: [[ST:%.+]] = type { float }
2705// CK22-DAG: [[STT:%.+]] = type { i32 }
2706
2707// CK22: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002708// CK22: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002709
2710// CK22: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002711// CK22: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002712
2713// CK22: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002714// CK22: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002715
2716// CK22: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002717// CK22: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002718
2719// CK22: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002720// CK22: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002721
2722// CK22: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002723// CK22: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002724
2725// CK22: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002726// CK22: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002727
2728// CK22: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002729// CK22: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002730
2731// CK22: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002732// CK22: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002733
2734// CK22: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002735// CK22: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002736
2737// CK22: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002738// CK22: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002739
2740// CK22: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002741// CK22: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002742
2743// CK22: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002744// CK22: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002745
2746// CK22: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002747// CK22: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002748
2749// CK22: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002750// CK22: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002751
2752int a;
2753int c[100];
2754int *d;
2755
2756struct ST {
2757 float fa;
2758};
2759
2760ST sa ;
2761ST sc[100];
2762ST *sd;
2763
2764template<typename T>
2765struct STT {
2766 T fa;
2767};
2768
2769STT<int> sta ;
2770STT<int> stc[100];
2771STT<int> *std;
2772
2773// CK22-LABEL: explicit_maps_globals
2774int explicit_maps_globals(void){
2775 // Region 00
2776 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2777 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2778 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2779
2780 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2781 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2782 // CK22-DAG: store i8* bitcast (i32* @a to i8*), i8** [[BP0]]
2783 // CK22-DAG: store i8* bitcast (i32* @a to i8*), i8** [[P0]]
2784
2785 // CK22: call void [[CALL00:@.+]](i32* {{[^,]+}})
2786 #pragma omp target map(a)
2787 { a+=1; }
2788
2789 // Region 01
2790 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2791 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2792 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2793
2794 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2795 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2796 // CK22-DAG: store i8* bitcast ([100 x i32]* @c to i8*), i8** [[BP0]]
2797 // CK22-DAG: store i8* bitcast ([100 x i32]* @c to i8*), i8** [[P0]]
2798
2799 // CK22: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
2800 #pragma omp target map(c)
2801 { c[3]+=1; }
2802
2803 // Region 02
2804 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2805 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2806 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2807
2808 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2809 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2810 // CK22-DAG: store i8* bitcast (i32** @d to i8*), i8** [[BP0]]
2811 // CK22-DAG: store i8* bitcast (i32** @d to i8*), i8** [[P0]]
2812
2813 // CK22: call void [[CALL02:@.+]](i32** {{[^,]+}})
2814 #pragma omp target map(d)
2815 { d[3]+=1; }
2816
2817 // Region 03
2818 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2819 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2820 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2821
2822 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2823 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2824 // CK22-DAG: store i8* bitcast ([100 x i32]* @c to i8*), i8** [[BP0]]
2825 // CK22-DAG: store i8* bitcast (i32* getelementptr inbounds ([100 x i32], [100 x i32]* @c, i{{.+}} 0, i{{.+}} 1) to i8*), i8** [[P0]]
2826
2827 // CK22: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
2828 #pragma omp target map(c[1:4])
2829 { c[3]+=1; }
2830
2831 // Region 04
2832 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2833 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2834 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2835
2836 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2837 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2838 // CK22-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2839 // CK22-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2840 // CK22-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
2841 // CK22-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2842 // CK22-DAG: [[RVAR0]] = load i32*, i32** @d
2843 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 2
2844 // CK22-DAG: [[RVAR00]] = load i32*, i32** @d
2845
2846 // CK22: call void [[CALL04:@.+]](i32* {{[^,]+}})
2847 #pragma omp target map(d[2:5])
2848 { d[3]+=1; }
2849
2850 // Region 05
2851 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
2852 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2853 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2854
2855 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2856 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2857 // CK22-DAG: store i8* bitcast ([[ST]]* @sa to i8*), i8** [[BP0]]
2858 // CK22-DAG: store i8* bitcast ([[ST]]* @sa to i8*), i8** [[P0]]
2859
2860 // CK22: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2861 #pragma omp target map(sa)
2862 { sa.fa+=1; }
2863
2864 // Region 06
2865 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
2866 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2867 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2868
2869 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2870 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2871 // CK22-DAG: store i8* bitcast ([100 x [[ST]]]* @sc to i8*), i8** [[BP0]]
2872 // CK22-DAG: store i8* bitcast ([100 x [[ST]]]* @sc to i8*), i8** [[P0]]
2873
2874 // CK22: call void [[CALL06:@.+]]([100 x [[ST]]]* {{[^,]+}})
2875 #pragma omp target map(sc)
2876 { sc[3].fa+=1; }
2877
2878 // Region 07
2879 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
2880 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2881 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2882
2883 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2884 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2885 // CK22-DAG: store i8* bitcast ([[ST]]** @sd to i8*), i8** [[BP0]]
2886 // CK22-DAG: store i8* bitcast ([[ST]]** @sd to i8*), i8** [[P0]]
2887
2888 // CK22: call void [[CALL07:@.+]]([[ST]]** {{[^,]+}})
2889 #pragma omp target map(sd)
2890 { sd[3].fa+=1; }
2891
2892 // Region 08
2893 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
2894 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2895 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2896
2897 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2898 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2899 // CK22-DAG: store i8* bitcast ([100 x [[ST]]]* @sc to i8*), i8** [[BP0]]
2900 // CK22-DAG: store i8* bitcast ([[ST]]* getelementptr inbounds ([100 x [[ST]]], [100 x [[ST]]]* @sc, i{{.+}} 0, i{{.+}} 1) to i8*), i8** [[P0]]
2901
2902 // CK22: call void [[CALL08:@.+]]([100 x [[ST]]]* {{[^,]+}})
2903 #pragma omp target map(sc[1:4])
2904 { sc[3].fa+=1; }
2905
2906 // Region 09
2907 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
2908 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2909 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2910
2911 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2912 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2913 // CK22-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2914 // CK22-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2915 // CK22-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[RVAR0:%.+]] to i8*
2916 // CK22-DAG: [[CPVAL0]] = bitcast [[ST]]* [[SEC0:%.+]] to i8*
2917 // CK22-DAG: [[RVAR0]] = load [[ST]]*, [[ST]]** @sd
2918 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[RVAR00:%.+]], i{{.+}} 2
2919 // CK22-DAG: [[RVAR00]] = load [[ST]]*, [[ST]]** @sd
2920
2921 // CK22: call void [[CALL09:@.+]]([[ST]]* {{[^,]+}})
2922 #pragma omp target map(sd[2:5])
2923 { sd[3].fa+=1; }
2924
2925 // Region 10
2926 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
2927 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2928 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2929
2930 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2931 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2932 // CK22-DAG: store i8* bitcast ([[STT]]* @sta to i8*), i8** [[BP0]]
2933 // CK22-DAG: store i8* bitcast ([[STT]]* @sta to i8*), i8** [[P0]]
2934
2935 // CK22: call void [[CALL10:@.+]]([[STT]]* {{[^,]+}})
2936 #pragma omp target map(sta)
2937 { sta.fa+=1; }
2938
2939 // Region 11
2940 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
2941 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2942 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2943
2944 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2945 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2946 // CK22-DAG: store i8* bitcast ([100 x [[STT]]]* @stc to i8*), i8** [[BP0]]
2947 // CK22-DAG: store i8* bitcast ([100 x [[STT]]]* @stc to i8*), i8** [[P0]]
2948
2949 // CK22: call void [[CALL11:@.+]]([100 x [[STT]]]* {{[^,]+}})
2950 #pragma omp target map(stc)
2951 { stc[3].fa+=1; }
2952
2953 // Region 12
2954 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
2955 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2956 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2957
2958 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2959 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2960 // CK22-DAG: store i8* bitcast ([[STT]]** @std to i8*), i8** [[BP0]]
2961 // CK22-DAG: store i8* bitcast ([[STT]]** @std to i8*), i8** [[P0]]
2962
2963 // CK22: call void [[CALL12:@.+]]([[STT]]** {{[^,]+}})
2964 #pragma omp target map(std)
2965 { std[3].fa+=1; }
2966
2967 // Region 13
2968 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
2969 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2970 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2971
2972 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2973 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2974 // CK22-DAG: store i8* bitcast ([100 x [[STT]]]* @stc to i8*), i8** [[BP0]]
2975 // CK22-DAG: store i8* bitcast ([[STT]]* getelementptr inbounds ([100 x [[STT]]], [100 x [[STT]]]* @stc, i{{.+}} 0, i{{.+}} 1) to i8*), i8** [[P0]]
2976
2977 // CK22: call void [[CALL13:@.+]]([100 x [[STT]]]* {{[^,]+}})
2978 #pragma omp target map(stc[1:4])
2979 { stc[3].fa+=1; }
2980
2981 // Region 14
2982 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
2983 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2984 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2985
2986 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2987 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2988 // CK22-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2989 // CK22-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2990 // CK22-DAG: [[CBPVAL0]] = bitcast [[STT]]* [[RVAR0:%.+]] to i8*
2991 // CK22-DAG: [[CPVAL0]] = bitcast [[STT]]* [[SEC0:%.+]] to i8*
2992 // CK22-DAG: [[RVAR0]] = load [[STT]]*, [[STT]]** @std
2993 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[STT]]* [[RVAR00:%.+]], i{{.+}} 2
2994 // CK22-DAG: [[RVAR00]] = load [[STT]]*, [[STT]]** @std
2995
2996 // CK22: call void [[CALL14:@.+]]([[STT]]* {{[^,]+}})
2997 #pragma omp target map(std[2:5])
2998 { std[3].fa+=1; }
2999
3000 return 0;
3001}
3002// CK22: define {{.+}}[[CALL00]]
3003// CK22: define {{.+}}[[CALL01]]
3004// CK22: define {{.+}}[[CALL02]]
3005// CK22: define {{.+}}[[CALL03]]
3006// CK22: define {{.+}}[[CALL04]]
3007// CK22: define {{.+}}[[CALL05]]
3008// CK22: define {{.+}}[[CALL06]]
3009// CK22: define {{.+}}[[CALL07]]
3010// CK22: define {{.+}}[[CALL08]]
3011// CK22: define {{.+}}[[CALL09]]
3012// CK22: define {{.+}}[[CALL10]]
3013// CK22: define {{.+}}[[CALL11]]
3014// CK22: define {{.+}}[[CALL12]]
3015// CK22: define {{.+}}[[CALL13]]
3016// CK22: define {{.+}}[[CALL14]]
3017#endif
3018///==========================================================================///
3019// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-64
3020// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3021// RUN: %clang_cc1 -std=c++11 -fopenmp -fomptargets=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
3022// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-32
3023// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3024// RUN: %clang_cc1 -std=c++11 -fopenmp -fomptargets=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
3025#ifdef CK23
3026
3027// CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003028// CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003029
3030// CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003031// CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003032
3033// CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00003034// CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003035
3036// CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003037// CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003038
3039// CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00003040// CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003041
3042// CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00003043// CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003044
3045// CK23-LABEL: explicit_maps_inside_captured
3046int explicit_maps_inside_captured(int a){
3047 float b;
3048 float c[100];
3049 float *d;
3050
3051 // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}})
3052 // CK23: define {{.*}}explicit_maps_inside_captured{{.*}}
3053 [&](void){
3054 // Region 00
3055 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
3056 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3057 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3058
3059 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3060 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3061 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3062 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3063 // CK23-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
3064 // CK23-DAG: [[CPVAL0]] = bitcast i32* [[VAR00:%.+]] to i8*
3065 // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]]
3066 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3067 // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]]
3068 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3069
3070 // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}})
3071 #pragma omp target map(a)
3072 { a+=1; }
3073 // Region 01
3074 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3075 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3076 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3077
3078 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3079 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3080 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3081 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3082 // CK23-DAG: [[CBPVAL0]] = bitcast float* [[VAR0:%.+]] to i8*
3083 // CK23-DAG: [[CPVAL0]] = bitcast float* [[VAR00:%.+]] to i8*
3084 // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]]
3085 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3086 // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]]
3087 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3088
3089 // CK23: call void [[CALL01:@.+]](float* {{[^,]+}})
3090 #pragma omp target map(b)
3091 { b+=1; }
3092 // Region 02
3093 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
3094 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3095 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3096
3097 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3098 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3099 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3100 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3101 // CK23-DAG: [[CBPVAL0]] = bitcast [100 x float]* [[VAR0:%.+]] to i8*
3102 // CK23-DAG: [[CPVAL0]] = bitcast [100 x float]* [[VAR00:%.+]] to i8*
3103 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3104 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3105 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3106 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3107
3108 // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}})
3109 #pragma omp target map(c)
3110 { c[3]+=1; }
3111
3112 // Region 03
3113 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
3114 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3115 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3116
3117 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3118 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3119 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3120 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3121 // CK23-DAG: [[CBPVAL0]] = bitcast float** [[VAR0:%.+]] to i8*
3122 // CK23-DAG: [[CPVAL0]] = bitcast float** [[VAR00:%.+]] to i8*
3123 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3124 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3125 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3126 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3127
3128 // CK23: call void [[CALL03:@.+]](float** {{[^,]+}})
3129 #pragma omp target map(d)
3130 { d[3]+=1; }
3131 // Region 04
3132 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
3133 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3134 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3135
3136 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3137 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3138 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3139 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3140 // CK23-DAG: [[CBPVAL0]] = bitcast [100 x float]* [[VAR0:%.+]] to i8*
3141 // CK23-DAG: [[CPVAL0]] = bitcast float* [[SEC0:%.+]] to i8*
3142 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3143 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3144 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3145 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3146 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3147
3148 // CK23: call void [[CALL04:@.+]]([100 x float]* {{[^,]+}})
3149 #pragma omp target map(c[2:4])
3150 { c[3]+=1; }
3151
3152 // Region 05
3153 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
3154 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3155 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3156
3157 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3158 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3159 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3160 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3161 // CK23-DAG: [[CBPVAL0]] = bitcast float* [[RVAR0:%.+]] to i8*
3162 // CK23-DAG: [[CPVAL0]] = bitcast float* [[SEC0:%.+]] to i8*
3163 // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
3164 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
3165 // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]]
3166 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3167 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3168 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3169 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3170
3171 // CK23: call void [[CALL05:@.+]](float* {{[^,]+}})
3172 #pragma omp target map(d[2:4])
3173 { d[3]+=1; }
3174 }();
3175 return b;
3176}
3177
3178// CK23: define {{.+}}[[CALL00]]
3179// CK23: define {{.+}}[[CALL01]]
3180// CK23: define {{.+}}[[CALL02]]
3181// CK23: define {{.+}}[[CALL03]]
3182// CK23: define {{.+}}[[CALL04]]
3183// CK23: define {{.+}}[[CALL05]]
3184#endif
3185///==========================================================================///
3186// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-64
3187// RUN: %clang_cc1 -DCK24 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3188// RUN: %clang_cc1 -fopenmp -fomptargets=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
3189// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-32
3190// RUN: %clang_cc1 -DCK24 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3191// RUN: %clang_cc1 -fopenmp -fomptargets=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
3192#ifdef CK24
3193
3194// CK24-DAG: [[SC:%.+]] = type { i32, [[SB:%.+]], [[SB:%.+]]*, [10 x i32] }
3195// CK24-DAG: [[SB]] = type { i32, [[SA:%.+]], [10 x [[SA:%.+]]], [10 x [[SA:%.+]]*], [[SA:%.+]]* }
3196// CK24-DAG: [[SA]] = type { i32, [[SA]]*, [10 x i32] }
3197
3198struct SA{
3199 int a;
3200 struct SA *p;
3201 int b[10];
3202};
3203struct SB{
3204 int a;
3205 struct SA s;
3206 struct SA sa[10];
3207 struct SA *sp[10];
3208 struct SA *p;
3209};
3210struct SC{
3211 int a;
3212 struct SB s;
3213 struct SB *p;
3214 int b[10];
3215};
3216
3217// CK24: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003218// CK24: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003219
3220// CK24: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003221// CK24: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003222
3223// CK24: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003224// CK24: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003225
3226// CK24: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00003227// CK24: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003228
3229// CK24: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003230// CK24: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003231
3232// CK24: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003233// CK24: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003234
3235// CK24: [[SIZE07:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003236// CK24: [[MTYPE07:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003237
3238// CK24: [[SIZE08:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003239// CK24: [[MTYPE08:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003240
3241// CK24: [[SIZE09:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003242// CK24: [[MTYPE09:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003243
3244// CK24: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 8]
Samuel Antao6782e942016-05-26 16:48:10 +00003245// CK24: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003246
3247// CK24: [[SIZE11:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003248// CK24: [[MTYPE11:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003249
3250// CK24: [[SIZE12:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003251// CK24: [[MTYPE12:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 19, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003252
3253// CK24: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003254// CK24: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003255
3256// CK24: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003257// CK24: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003258
3259// CK24: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003260// CK24: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003261
3262// CK24: [[SIZE16:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00003263// CK24: [[MTYPE16:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003264
3265// CK24: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003266// CK24: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003267
3268// CK24: [[SIZE18:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003269// CK24: [[MTYPE18:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003270
3271// CK24: [[SIZE19:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003272// CK24: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003273
3274// CK24: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003275// CK24: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003276
3277// CK24: [[SIZE21:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003278// CK24: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003279
3280// CK24: [[SIZE22:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003281// CK24: [[MTYPE22:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003282
3283// CK24: [[SIZE23:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003284// CK24: [[MTYPE23:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003285
3286// CK24: [[SIZE24:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003287// CK24: [[MTYPE24:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 19, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003288
3289// CK24-LABEL: explicit_maps_struct_fields
3290int explicit_maps_struct_fields(int a){
3291 SC s;
3292 SC *p;
3293
3294// Region 01
3295// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3296// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3297// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3298
3299// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3300// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3301// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3302// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3303// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3304// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3305// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
3306
3307// CK24: call void [[CALL01:@.+]]([[SC]]* {{[^,]+}})
3308#pragma omp target map(s.a)
3309 { s.a++; }
3310
3311// Region 02
3312// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
3313// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3314// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3315
3316// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3317// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3318// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3319// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3320// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3321// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]* [[SEC0:%.+]] to i8*
3322// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3323// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3324
3325// CK24: call void [[CALL02:@.+]]([[SC]]* {{[^,]+}})
3326#pragma omp target map(s.s.s)
3327 { s.a++; }
3328
3329// Region 03
3330// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
3331// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3332// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3333
3334// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3335// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3336// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3337// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3338// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3339// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3340// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3341// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3342// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3343
3344// CK24: call void [[CALL03:@.+]]([[SC]]* {{[^,]+}})
3345#pragma omp target map(s.s.s.a)
3346 { s.a++; }
3347
3348// Region 04
3349// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
3350// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3351// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3352
3353// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3354// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3355// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3356// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3357// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3358// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3359// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3360// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 3
3361
3362// CK24: call void [[CALL04:@.+]]([[SC]]* {{[^,]+}})
3363#pragma omp target map(s.b[:5])
3364 { s.a++; }
3365
3366// Region 05
3367// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
3368// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3369// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3370
3371// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3372// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3373// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3374// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3375// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3376// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3377// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3378
3379// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3380// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3381// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3382// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3383// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3384// CK24-DAG: [[CPVAL1]] = bitcast [[SB]]* [[SEC1:%.+]] to i8*
3385// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3386// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3387// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3388
3389// CK24: call void [[CALL05:@.+]]([[SC]]* {{[^,]+}})
3390#pragma omp target map(s.p[:5])
3391 { s.a++; }
3392
3393// Region 06
3394// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
3395// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3396// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3397
3398// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3399// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3400// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3401// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3402// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3403// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3404// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3405// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3406// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3407// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3408
3409// CK24: call void [[CALL06:@.+]]([[SC]]* {{[^,]+}})
3410#pragma omp target map(s.s.sa[3].a)
3411 { s.a++; }
3412
3413// Region 07
3414// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE07]]{{.+}})
3415// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3416// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3417
3418// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3419// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3420// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3421// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3422// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3423// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3424// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3425// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3426// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3427
3428// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3429// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3430// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3431// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3432// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3433// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3434// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3435// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3436// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3437// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3438// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3439
3440// CK24: call void [[CALL07:@.+]]([[SC]]* {{[^,]+}})
3441#pragma omp target map(s.s.sp[3]->a)
3442 { s.a++; }
3443
3444// Region 08
3445// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE08]]{{.+}})
3446// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3447// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3448
3449// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3450// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3451// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3452// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3453// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3454// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3455// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3456
3457// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3458// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3459// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3460// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3461// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3462// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3463// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3464// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3465// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3466
3467// CK24: call void [[CALL08:@.+]]([[SC]]* {{[^,]+}})
3468#pragma omp target map(s.p->a)
3469 { s.a++; }
3470
3471// Region 09
3472// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE09]]{{.+}})
3473// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3474// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3475
3476// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3477// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3478// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3479// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3480// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3481// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3482// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3483// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3484
3485// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3486// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3487// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3488// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3489// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3490// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3491// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3492// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3493// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3494// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3495
3496// CK24: call void [[CALL09:@.+]]([[SC]]* {{[^,]+}})
3497#pragma omp target map(s.s.p->a)
3498 { s.a++; }
3499
3500// Region 10
3501// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
3502// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3503// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3504
3505// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3506// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3507// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3508// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3509// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3510// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3511// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3512// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3513// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3514// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3515
3516// CK24: call void [[CALL10:@.+]]([[SC]]* {{[^,]+}})
3517#pragma omp target map(s.s.s.b[:2])
3518 { s.a++; }
3519
3520// Region 11
3521// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE11]]{{.+}})
3522// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3523// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3524
3525// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3526// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3527// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3528// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3529// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3530// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3531// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3532// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3533
3534// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3535// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3536// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3537// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3538// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3539// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3540// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3541// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3542// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3543// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3544// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3545
3546// CK24: call void [[CALL11:@.+]]([[SC]]* {{[^,]+}})
3547#pragma omp target map(s.s.p->b[:2])
3548 { s.a++; }
3549
3550// Region 12
3551// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE12]]{{.+}})
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 [[SB]]** [[SEC0:%.+]] to i8*
3561// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3562
3563// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3564// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3565// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3566// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3567// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3568// CK24-DAG: [[CPVAL1]] = bitcast [[SA]]** [[SEC1:%.+]] to i8*
3569// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3570// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3571// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3572
3573// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3574// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
3575// CK24-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
3576// CK24-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
3577// CK24-DAG: [[CBPVAL2]] = bitcast [[SA]]** [[SEC1]] to i8*
3578// CK24-DAG: [[CPVAL2]] = bitcast [[SA]]** [[SEC2:%.+]] to i8*
3579// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3580// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
3581// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3582// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
3583// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3584
3585// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
3586// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
3587// CK24-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
3588// CK24-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
3589// CK24-DAG: [[CBPVAL3]] = bitcast [[SA]]** [[SEC2]] to i8*
3590// CK24-DAG: [[CPVAL3]] = bitcast i32* [[SEC3:%.+]] to i8*
3591// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3592// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
3593// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3594// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
3595// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3596// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
3597// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3598
3599// CK24: call void [[CALL12:@.+]]([[SC]]* {{[^,]+}})
3600#pragma omp target map(s.p->p->p->a)
3601 { s.a++; }
3602
3603//
3604// Same thing but starting from a pointer.
3605//
3606// Region 13
3607// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
3608// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3609// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3610
3611// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3612// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3613// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3614// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3615// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3616// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3617// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 0
3618
3619// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3620// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3621
3622// CK24: call void [[CALL13:@.+]]([[SC]]* {{[^,]+}})
3623#pragma omp target map(p->a)
3624 { p->a++; }
3625
3626// Region 14
3627// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
3628// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3629// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3630
3631// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3632// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3633// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3634// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3635// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3636// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]* [[SEC0:%.+]] to i8*
3637// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3638// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3639
3640// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3641// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3642
3643// CK24: call void [[CALL14:@.+]]([[SC]]* {{[^,]+}})
3644#pragma omp target map(p->s.s)
3645 { p->a++; }
3646
3647// Region 15
3648// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
3649// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3650// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3651
3652// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3653// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3654// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3655// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3656// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3657// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3658// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3659// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3660// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3661
3662// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3663// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3664
3665// CK24: call void [[CALL15:@.+]]([[SC]]* {{[^,]+}})
3666#pragma omp target map(p->s.s.a)
3667 { p->a++; }
3668
3669// Region 16
3670// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE16]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE16]]{{.+}})
3671// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3672// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3673
3674// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3675// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3676// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3677// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3678// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3679// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3680// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3681// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 3
3682
3683// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3684// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3685
3686// CK24: call void [[CALL16:@.+]]([[SC]]* {{[^,]+}})
3687#pragma omp target map(p->b[:5])
3688 { p->a++; }
3689
3690// Region 17
3691// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
3692// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3693// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3694
3695// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3696// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3697// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3698// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3699// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3700// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3701// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3702
3703// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3704// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3705// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3706// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3707// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3708// CK24-DAG: [[CPVAL1]] = bitcast [[SB]]* [[SEC1:%.+]] to i8*
3709// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3710// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3711// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3712
3713// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3714// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3715// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3716
3717// CK24: call void [[CALL17:@.+]]([[SC]]* {{[^,]+}})
3718#pragma omp target map(p->p[:5])
3719 { p->a++; }
3720
3721// Region 18
3722// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE18]]{{.+}})
3723// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3724// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3725
3726// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3727// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3728// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3729// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3730// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3731// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3732// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3733// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3734// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3735// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3736
3737// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3738// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3739
3740// CK24: call void [[CALL18:@.+]]([[SC]]* {{[^,]+}})
3741#pragma omp target map(p->s.sa[3].a)
3742 { p->a++; }
3743
3744// Region 19
3745// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE19]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
3746// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3747// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3748
3749// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3750// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3751// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3752// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3753// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3754// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3755// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3756// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3757// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3758
3759// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3760// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3761// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3762// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3763// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3764// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3765// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3766// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3767// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3768// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3769// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3770
3771// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3772// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3773// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3774
3775// CK24: call void [[CALL19:@.+]]([[SC]]* {{[^,]+}})
3776#pragma omp target map(p->s.sp[3]->a)
3777 { p->a++; }
3778
3779// Region 20
3780// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
3781// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3782// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3783
3784// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3785// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3786// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3787// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3788// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3789// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3790// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3791
3792// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3793// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3794// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3795// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3796// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3797// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3798// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3799// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3800// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3801
3802// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3803// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3804// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3805
3806// CK24: call void [[CALL20:@.+]]([[SC]]* {{[^,]+}})
3807#pragma omp target map(p->p->a)
3808 { p->a++; }
3809
3810// Region 21
3811// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE21]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
3812// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3813// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3814
3815// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3816// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3817// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3818// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3819// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3820// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3821// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3822// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3823
3824// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3825// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3826// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3827// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3828// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3829// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3830// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3831// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3832// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3833// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3834
3835// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3836// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3837// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3838
3839// CK24: call void [[CALL21:@.+]]([[SC]]* {{[^,]+}})
3840#pragma omp target map(p->s.p->a)
3841 { p->a++; }
3842
3843// Region 22
3844// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE22]]{{.+}})
3845// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3846// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3847
3848// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3849// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3850// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3851// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3852// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3853// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3854// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3855// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3856// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3857// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3858
3859// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3860// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3861
3862// CK24: call void [[CALL22:@.+]]([[SC]]* {{[^,]+}})
3863#pragma omp target map(p->s.s.b[:2])
3864 { p->a++; }
3865
3866// Region 23
3867// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE23]]{{.+}})
3868// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3869// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3870
3871// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3872// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3873// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3874// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3875// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3876// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3877// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3878// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3879
3880// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3881// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3882// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3883// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3884// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3885// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3886// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3887// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3888// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3889// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3890// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3891
3892// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3893// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3894// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3895
3896// CK24: call void [[CALL23:@.+]]([[SC]]* {{[^,]+}})
3897#pragma omp target map(p->s.p->b[:2])
3898 { p->a++; }
3899
3900// Region 24
3901// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE24]]{{.+}})
3902// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3903// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3904
3905// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3906// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3907// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3908// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3909// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3910// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3911// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3912
3913// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3914// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3915// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3916// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3917// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3918// CK24-DAG: [[CPVAL1]] = bitcast [[SA]]** [[SEC1:%.+]] to i8*
3919// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3920// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3921// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3922
3923// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3924// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
3925// CK24-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
3926// CK24-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
3927// CK24-DAG: [[CBPVAL2]] = bitcast [[SA]]** [[SEC1]] to i8*
3928// CK24-DAG: [[CPVAL2]] = bitcast [[SA]]** [[SEC2:%.+]] to i8*
3929// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3930// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
3931// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3932// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
3933// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0000:%.+]], i{{.+}} 0, i{{.+}} 2
3934
3935// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
3936// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
3937// CK24-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
3938// CK24-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
3939// CK24-DAG: [[CBPVAL3]] = bitcast [[SA]]** [[SEC2]] to i8*
3940// CK24-DAG: [[CPVAL3]] = bitcast i32* [[SEC3:%.+]] to i8*
3941// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3942// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
3943// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3944// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
3945// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3946// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
3947// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR00000:%.+]], i{{.+}} 0, i{{.+}} 2
3948
3949// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3950// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3951// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3952// CK24-DAG: [[VAR0000]] = load [[SC]]*, [[SC]]** %{{.+}}
3953// CK24-DAG: [[VAR00000]] = load [[SC]]*, [[SC]]** %{{.+}}
3954
3955// CK24: call void [[CALL24:@.+]]([[SC]]* {{[^,]+}})
3956#pragma omp target map(p->p->p->p->a)
3957 { p->a++; }
3958
3959 return s.a;
3960}
3961
3962// CK24: define {{.+}}[[CALL01]]
3963// CK24: define {{.+}}[[CALL02]]
3964// CK24: define {{.+}}[[CALL03]]
3965// CK24: define {{.+}}[[CALL04]]
3966// CK24: define {{.+}}[[CALL05]]
3967// CK24: define {{.+}}[[CALL06]]
3968// CK24: define {{.+}}[[CALL07]]
3969// CK24: define {{.+}}[[CALL08]]
3970// CK24: define {{.+}}[[CALL09]]
3971// CK24: define {{.+}}[[CALL10]]
3972// CK24: define {{.+}}[[CALL11]]
3973// CK24: define {{.+}}[[CALL12]]
3974// CK24: define {{.+}}[[CALL13]]
3975// CK24: define {{.+}}[[CALL14]]
3976// CK24: define {{.+}}[[CALL15]]
3977// CK24: define {{.+}}[[CALL16]]
3978// CK24: define {{.+}}[[CALL17]]
3979// CK24: define {{.+}}[[CALL18]]
3980// CK24: define {{.+}}[[CALL19]]
3981// CK24: define {{.+}}[[CALL20]]
3982// CK24: define {{.+}}[[CALL21]]
3983// CK24: define {{.+}}[[CALL22]]
3984// CK24: define {{.+}}[[CALL23]]
3985// CK24: define {{.+}}[[CALL24]]
3986#endif
3987///==========================================================================///
3988// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-64
3989// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3990// RUN: %clang_cc1 -fopenmp -std=c++11 -fomptargets=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
3991// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-32
3992// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3993// RUN: %clang_cc1 -fopenmp -std=c++11 -fomptargets=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
3994#ifdef CK25
3995// CK25: [[ST:%.+]] = type { i32, float }
3996// CK25: [[CA00:%.+]] = type { [[ST]]* }
3997// CK25: [[CA01:%.+]] = type { i32* }
3998
3999// CK25: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004000// CK25: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00004001
4002// CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004003// CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00004004
4005// CK25-LABEL: explicit_maps_with_inner_lambda
4006
4007template <int X, typename T>
4008struct CC {
4009 T A;
4010 float B;
4011
4012 int foo(T arg) {
4013 // Region 00
4014 // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4015 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4016 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4017
4018 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4019 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4020 // CK25-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4021 // CK25-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4022 // CK25-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4023 // CK25-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4024 // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
4025
4026 // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
4027 #pragma omp target map(to:A)
4028 {
4029 [&]() {
4030 A += 1;
4031 }();
4032 }
4033
4034 // Region 01
4035 // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4036 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4037 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4038
4039 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4040 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4041 // CK25-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4042 // CK25-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4043 // CK25-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
4044 // CK25-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
4045
4046 // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}})
4047 #pragma omp target map(to:arg)
4048 {
4049 [&]() {
4050 arg += 1;
4051 }();
4052 }
4053
4054 return A+arg;
4055 }
4056};
4057
4058int explicit_maps_with_inner_lambda(int a){
4059 CC<123,int> c;
4060 return c.foo(a);
4061}
4062
4063// CK25: define {{.+}}[[CALL00]]([[ST]]* [[VAL:%.+]])
4064// CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]],
4065// CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]],
4066// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0
4067// CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]],
4068// CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* [[CA]])
4069
4070// CK25: define {{.+}}[[LAMBDA]]
4071
4072// CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]])
4073// CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]],
4074// CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]],
4075// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0
4076// CK25: store i32* [[VAL1]], i32** [[VALADDR1]],
4077// CK25: call void {{.*}}[[LAMBDA]]{{.*}}([[CA01]]* [[CA]])
4078#endif
4079///==========================================================================///
4080// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
4081// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4082// RUN: %clang_cc1 -fopenmp -std=c++11 -fomptargets=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
4083// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
4084// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4085// RUN: %clang_cc1 -fopenmp -std=c++11 -fomptargets=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
4086#ifdef CK26
4087// CK26: [[ST:%.+]] = type { i32, float*, i32, float* }
4088
4089// CK26: [[SIZE00:@.+]] = private {{.*}}constant [2 x i[[Z:64|32]]] [i[[Z:64|32]] {{32|16}}, i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004090// CK26: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004091
4092// CK26: [[SIZE01:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004093// CK26: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004094
4095// CK26: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004096// CK26: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004097
4098// CK26: [[SIZE03:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004099// CK26: [[MTYPE03:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004100
4101// CK26-LABEL: explicit_maps_with_private_class_members
4102
4103struct CC {
4104 int fA;
4105 float &fB;
4106 int pA;
4107 float &pB;
4108
4109 CC(float &B) : fB(B), pB(B) {
4110
4111 // CK26: call {{.*}}@__kmpc_fork_call{{.*}} [[OUTCALL:@.+]] to void (i32*, i32*, ...)*
4112 // define {{.*}}void [[OUTCALL]]
4113 #pragma omp parallel firstprivate(fA,fB) private(pA,pB)
4114 {
4115 // Region 00
4116 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}})
4117 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4118 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4119
4120 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4121 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4122 // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4123 // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4124 // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4125 // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4126
4127 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4128 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4129 // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4130 // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4131 // CK26-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
4132 // CK26-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
4133 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4134 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4135
4136 // CK26: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4137 #pragma omp target map(fA)
4138 {
4139 ++fA;
4140 }
4141
4142 // Region 01
4143 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}})
4144 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4145 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4146
4147 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4148 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4149 // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4150 // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4151 // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4152 // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4153
4154 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4155 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4156 // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4157 // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4158 // CK26-DAG: [[CBPVAL1]] = bitcast float* [[VAR1:%.+]] to i8*
4159 // CK26-DAG: [[CPVAL1]] = bitcast float* [[SEC1:%.+]] to i8*
4160 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4161 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4162
4163 // CK26: call void [[CALL01:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4164 #pragma omp target map(fB)
4165 {
4166 fB += 1.0;
4167 }
4168
4169 // Region 02
4170 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
4171 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4172 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4173
4174 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4175 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4176 // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4177 // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4178 // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4179 // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4180
4181 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4182 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4183 // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4184 // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4185 // CK26-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
4186 // CK26-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
4187 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4188 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4189
4190 // CK26: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4191 #pragma omp target map(pA)
4192 {
4193 ++pA;
4194 }
4195
4196 // Region 01
4197 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE03]]{{.+}})
4198 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4199 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4200
4201 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4202 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4203 // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4204 // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4205 // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4206 // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4207
4208 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4209 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4210 // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4211 // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4212 // CK26-DAG: [[CBPVAL1]] = bitcast float* [[VAR1:%.+]] to i8*
4213 // CK26-DAG: [[CPVAL1]] = bitcast float* [[SEC1:%.+]] to i8*
4214 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4215 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4216
4217 // CK26: call void [[CALL03:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4218 #pragma omp target map(pB)
4219 {
4220 pB += 1.0;
4221 }
4222 }
4223 }
4224
4225 int foo() {
4226 return fA + pA;
4227 }
4228};
4229
4230// Make sure the private instance is used in all target regions.
4231// CK26: define {{.+}}[[CALL00]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4232// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4233// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4234// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4235// CK26: add nsw i32 [[VAL]], 1
4236
4237// CK26: define {{.+}}[[CALL01]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4238// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4239// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4240// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4241// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4242// CK26: fadd double [[EXT]], 1.000000e+00
4243
4244// CK26: define {{.+}}[[CALL02]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4245// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4246// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4247// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4248// CK26: add nsw i32 [[VAL]], 1
4249
4250// CK26: define {{.+}}[[CALL03]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4251// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4252// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4253// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4254// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4255// CK26: fadd double [[EXT]], 1.000000e+00
4256
4257int explicit_maps_with_private_class_members(){
4258 float B;
4259 CC c(B);
4260 return c.foo();
4261}
4262#endif
Samuel Antao6782e942016-05-26 16:48:10 +00004263///==========================================================================///
4264// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-64
4265// RUN: %clang_cc1 -DCK27 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4266// RUN: %clang_cc1 -fopenmp -fomptargets=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
4267// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-32
4268// RUN: %clang_cc1 -DCK27 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4269// RUN: %clang_cc1 -fopenmp -fomptargets=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
4270#ifdef CK27
4271
4272// CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] zeroinitializer
4273// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
4274
4275// CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4276// CK27: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4277
4278// CK27: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4279// CK27: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4280
4281// CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4282// CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4283
4284// CK27-LABEL: zero_size_section_maps
4285void zero_size_section_maps (int ii){
4286
4287 // Map of a pointer.
4288 int *pa;
4289
4290 // Region 00
4291 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4292 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4293 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4294
4295 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4296 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4297 // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4298 // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4299 // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
4300 // CK27-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
4301
4302 // CK27: call void [[CALL00:@.+]](i32* {{[^,]+}})
4303 #pragma omp target
4304 {
4305 pa[50]++;
4306 }
4307
4308 // Region 01
4309 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4310 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4311 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4312
4313 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4314 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4315 // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4316 // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4317 // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
4318 // CK27-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4319 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4320 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4321 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4322
4323 // CK27: call void [[CALL01:@.+]](i32* {{[^,]+}})
4324 #pragma omp target map(pa[:0])
4325 {
4326 pa[50]++;
4327 }
4328
4329 // Region 02
4330 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
4331 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4332 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4333
4334 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4335 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4336 // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4337 // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4338 // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
4339 // CK27-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4340 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4341 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4342 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4343
4344 // CK27: call void [[CALL02:@.+]](i32* {{[^,]+}})
4345 #pragma omp target map(pa[0:0])
4346 {
4347 pa[50]++;
4348 }
4349
4350 // Region 03
4351 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
4352 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4353 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4354
4355 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4356 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4357 // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4358 // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4359 // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
4360 // CK27-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4361 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4362 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.+}}
4363 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4364
4365 // CK27: call void [[CALL03:@.+]](i32* {{[^,]+}})
4366 #pragma omp target map(pa[ii:0])
4367 {
4368 pa[50]++;
4369 }
4370}
4371
4372// CK27: define {{.+}}[[CALL00]]
4373// CK27: define {{.+}}[[CALL01]]
4374// CK27: define {{.+}}[[CALL02]]
4375// CK27: define {{.+}}[[CALL03]]
4376
4377#endif
Samuel Antao4af1b7b2015-12-02 17:44:43 +00004378#endif