blob: 92ed0abf9495bac7b3bd5fee8d40cda0bff35019 [file] [log] [blame]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001// expected-no-diagnostics
2#ifndef HEADER
3#define HEADER
4
5///
6/// Implicit maps.
7///
8
9///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +000010// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
11// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
12// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
13// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
14// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
15// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +000016#ifdef CK1
17
18// CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000019// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
20// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000021
22// CK1-LABEL: implicit_maps_integer
23void implicit_maps_integer (int a){
24 int i = a;
25
26 // CK1-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
27 // CK1-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
28 // CK1-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
29 // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
30 // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
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 Antao1168d63c2016-06-30 21:22:08 +000055// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
56// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
57// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
58// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-32
59// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
60// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +000061#ifdef CK2
62
Samuel Antao403ffd42016-07-27 22:49:49 +000063// CK2: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +000064// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
Samuel Antao403ffd42016-07-27 22:49:49 +000065// CK2: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
66// CK2: [[SIZES2:@.+]] = {{.+}}constant [1 x i[[sz]]] zeroinitializer
67// Map types: OMP_MAP_IS_PTR = 32
68// CK2: [[TYPES2:@.+]] = {{.+}}constant [1 x i32] [i32 32]
Samuel Antao4af1b7b2015-12-02 17:44:43 +000069
Samuel Antao403ffd42016-07-27 22:49:49 +000070// CK2-LABEL: implicit_maps_reference
71void implicit_maps_reference (int a, int *b){
Samuel Antao4af1b7b2015-12-02 17:44:43 +000072 int &i = a;
73 // CK2-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
74 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
75 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
76 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
77 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
78 // CK2-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
79 // CK2-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
80 // CK2-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
81 // CK2-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
82 // CK2-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
83 // CK2-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
84 // CK2-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
85
86 // CK2: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
87 #pragma omp target
88 {
89 ++i;
90 }
Samuel Antao403ffd42016-07-27 22:49:49 +000091
92 int *&p = b;
93 // CK2-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
94 // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
95 // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
96 // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
97 // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
98 // CK2-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
99 // CK2-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
100 // CK2-DAG: [[VALBP]] = bitcast i32* [[VAL:%.+]] to i8*
101 // CK2-DAG: [[VALP]] = bitcast i32* [[VAL]] to i8*
102 // CK2-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]],
103 // CK2-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]],
104
105 // CK2: call void [[KERNEL2:@.+]](i32* [[VAL]])
106 #pragma omp target
107 {
108 ++p;
109 }
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000110}
111
112// CK2: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
113// CK2: [[ADDR:%.+]] = alloca i[[sz]],
114// CK2: [[REF:%.+]] = alloca i32*,
115// CK2: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
116// CK2-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
117// CK2-64: store i32* [[CADDR]], i32** [[REF]],
118// CK2-64: [[RVAL:%.+]] = load i32*, i32** [[REF]],
119// CK2-64: {{.+}} = load i32, i32* [[RVAL]],
120// CK2-32: store i32* [[ADDR]], i32** [[REF]],
121// CK2-32: [[RVAL:%.+]] = load i32*, i32** [[REF]],
122// CK2-32: {{.+}} = load i32, i32* [[RVAL]],
123
Samuel Antao403ffd42016-07-27 22:49:49 +0000124// CK2: define internal void [[KERNEL2]](i32* [[ARG:%.+]])
125// CK2: [[ADDR:%.+]] = alloca i32*,
126// CK2: [[REF:%.+]] = alloca i32**,
127// CK2: store i32* [[ARG]], i32** [[ADDR]],
128// CK2: store i32** [[ADDR]], i32*** [[REF]],
129// CK2: [[T:%.+]] = load i32**, i32*** [[REF]],
130// CK2: [[TT:%.+]] = load i32*, i32** [[T]],
131// CK2: getelementptr inbounds i32, i32* [[TT]], i32 1
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000132#endif
133///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000134// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-64
135// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
136// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-64
137// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-32
138// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
139// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK3 --check-prefix CK3-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000140#ifdef CK3
141
142// CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000143// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
144// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000145
146// CK3-LABEL: implicit_maps_parameter
147void implicit_maps_parameter (int a){
148
149 // CK3-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
150 // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
151 // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
152 // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
153 // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
154 // CK3-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
155 // CK3-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
156 // CK3-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
157 // CK3-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
158 // CK3-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
159 // CK3-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
160 // CK3-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
161
162 // CK3: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
163 #pragma omp target
164 {
165 ++a;
166 }
167}
168
169// CK3: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
170// CK3: [[ADDR:%.+]] = alloca i[[sz]],
171// CK3: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
172// CK3-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
173// CK3-64: {{.+}} = load i32, i32* [[CADDR]],
174// CK3-32: {{.+}} = load i32, i32* [[ADDR]],
175
176#endif
177///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000178// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-64
179// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
180// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-64
181// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-32
182// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
183// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK4 --check-prefix CK4-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000184#ifdef CK4
185
186// CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000187// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
188// CK4-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000189
190// CK4-LABEL: implicit_maps_nested_integer
191void implicit_maps_nested_integer (int a){
192 int i = a;
193
194 // The captures in parallel are by reference. Only the capture in target is by
195 // copy.
196
197 // CK4: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP1:@.+]] to void (i32*, i32*, ...)*), i32* {{.+}})
198 // CK4: define internal void [[KERNELP1]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
199 #pragma omp parallel
200 {
201 // CK4-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
202 // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
203 // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
204 // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
205 // CK4-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
206 // CK4-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
207 // CK4-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
208 // CK4-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
209 // CK4-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
210 // CK4-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
211 // CK4-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
212 // CK4-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
213
214 // CK4: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
215 #pragma omp target
216 {
217 #pragma omp parallel
218 {
219 ++i;
220 }
221 }
222 }
223}
224
225// CK4: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
226// CK4: [[ADDR:%.+]] = alloca i[[sz]],
227// CK4: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
228// CK4-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
229// CK4-64: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[CADDR]])
230// CK4-32: call void {{.+}}@__kmpc_fork_call({{.+}} [[KERNELP2:@.+]] to void (i32*, i32*, ...)*), i32* [[ADDR]])
231// CK4: define internal void [[KERNELP2]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}})
232#endif
233///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000234// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-64
235// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
236// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-64
237// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-32
238// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
239// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK5 --check-prefix CK5-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000240#ifdef CK5
241
242// CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000243// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
244// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000245
246// CK5-LABEL: implicit_maps_nested_integer_and_enum
247void implicit_maps_nested_integer_and_enum (int a){
248 enum Bla {
249 SomeEnum = 0x09
250 };
251
252 // Using an enum should not change the mapping information.
253 int i = a;
254
255 // CK5-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
256 // CK5-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
257 // CK5-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
258 // CK5-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
259 // CK5-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
260 // CK5-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
261 // CK5-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
262 // CK5-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
263 // CK5-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
264 // CK5-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
265 // CK5-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
266 // CK5-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
267
268 // CK5: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
269 #pragma omp target
270 {
271 ++i;
272 i += SomeEnum;
273 }
274}
275
276// CK5: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
277// CK5: [[ADDR:%.+]] = alloca i[[sz]],
278// CK5: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
279// CK5-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
280// CK5-64: {{.+}} = load i32, i32* [[CADDR]],
281// CK5-32: {{.+}} = load i32, i32* [[ADDR]],
282
283#endif
284///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000285// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-64
286// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
287// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-64
288// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-32
289// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
290// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK6 --check-prefix CK6-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000291#ifdef CK6
292// CK6-DAG: [[GBL:@Gi]] = global i32 0
293// CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000294// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
295// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000296
297// CK6-LABEL: implicit_maps_host_global
298int Gi;
299void implicit_maps_host_global (int a){
300 // CK6-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
301 // CK6-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
302 // CK6-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
303 // CK6-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
304 // CK6-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
305 // CK6-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
306 // CK6-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
307 // CK6-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
308 // CK6-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
309 // CK6-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
310 // CK6-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
311 // CK6-64-DAG: store i32 [[GBLVAL:%.+]], i32* [[CADDR]],
312 // CK6-64-DAG: [[GBLVAL]] = load i32, i32* [[GBL]],
313 // CK6-32-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[GBLVAL:%.+]],
314
315 // CK6: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
316 #pragma omp target
317 {
318 ++Gi;
319 }
320}
321
322// CK6: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
323// CK6: [[ADDR:%.+]] = alloca i[[sz]],
324// CK6: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
325// CK6-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
326// CK6-64: {{.+}} = load i32, i32* [[CADDR]],
327// CK6-32: {{.+}} = load i32, i32* [[ADDR]],
328
329#endif
330///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000331// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-64
332// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
333// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-64
334// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-32
335// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
336// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK7 --check-prefix CK7-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000337#ifdef CK7
338
339// For a 32-bit targets, the value doesn't fit the size of the pointer,
340// therefore it is passed by reference with a map 'to' specification.
341
342// CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000343// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
344// CK7-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
345// Map types: OMP_MAP_TO | OMP_MAP_IS_FIRST = 33
346// CK7-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000347
348// CK7-LABEL: implicit_maps_double
349void implicit_maps_double (int a){
350 double d = (double)a;
351
352 // CK7-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
353 // CK7-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
354 // CK7-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
355 // CK7-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
356 // CK7-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
357
358 // CK7-64-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
359 // CK7-64-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
360 // CK7-64-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
361 // CK7-64-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
362 // CK7-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
363 // CK7-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double*
364 // CK7-64-64-DAG: store double {{.+}}, double* [[CADDR]],
365
366 // CK7-32-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
367 // CK7-32-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
368 // CK7-32-DAG: [[VALBP]] = bitcast double* [[DECL:%.+]] to i8*
369 // CK7-32-DAG: [[VALP]] = bitcast double* [[DECL]] to i8*
370
371 // CK7-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
372 // CK7-32: call void [[KERNEL:@.+]](double* [[DECL]])
373 #pragma omp target
374 {
375 d += 1.0;
376 }
377}
378
379// CK7-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
380// CK7-64: [[ADDR:%.+]] = alloca i[[sz]],
381// CK7-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
382// CK7-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double*
383// CK7-64: {{.+}} = load double, double* [[CADDR]],
384
385// CK7-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]])
386// CK7-32: [[ADDR:%.+]] = alloca double*,
387// CK7-32: store double* [[ARG]], double** [[ADDR]],
388// CK7-32: [[REF:%.+]] = load double*, double** [[ADDR]],
389// CK7-32: {{.+}} = load double, double* [[REF]],
390
391#endif
392///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000393// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK8
394// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
395// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK8
396// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK8
397// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
398// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK8
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000399#ifdef CK8
400
401// CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
Samuel Antao6782e942016-05-26 16:48:10 +0000402// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288
403// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000404
405// CK8-LABEL: implicit_maps_float
406void implicit_maps_float (int a){
407 float f = (float)a;
408
409 // CK8-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
410 // CK8-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
411 // CK8-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
412 // CK8-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
413 // CK8-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
414 // CK8-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
415 // CK8-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
416 // CK8-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
417 // CK8-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
418 // CK8-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
419 // CK8-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
420 // CK8-DAG: store float {{.+}}, float* [[CADDR]],
421
422 // CK8: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
423 #pragma omp target
424 {
425 f += 1.0;
426 }
427}
428
429// CK8: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
430// CK8: [[ADDR:%.+]] = alloca i[[sz]],
431// CK8: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
432// CK8: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to float*
433// CK8: {{.+}} = load float, float* [[CADDR]],
434
435#endif
436///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000437// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK9
438// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
439// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK9
440// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK9
441// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
442// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK9
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000443#ifdef CK9
444
445// CK9-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Samuel Antao6782e942016-05-26 16:48:10 +0000446// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
447// CK9-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 35]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000448
449// CK9-LABEL: implicit_maps_array
450void implicit_maps_array (int a){
451 double darr[2] = {(double)a, (double)a};
452
453 // CK9-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
454 // CK9-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
455 // CK9-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
456 // CK9-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
457 // CK9-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
458 // CK9-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
459 // CK9-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
460 // CK9-DAG: [[VALBP]] = bitcast [2 x double]* [[DECL:%.+]] to i8*
461 // CK9-DAG: [[VALP]] = bitcast [2 x double]* [[DECL]] to i8*
462
463 // CK9: call void [[KERNEL:@.+]]([2 x double]* [[DECL]])
464 #pragma omp target
465 {
466 darr[0] += 1.0;
467 darr[1] += 1.0;
468 }
469}
470
471// CK9: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]])
472// CK9: [[ADDR:%.+]] = alloca [2 x double]*,
473// CK9: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]],
474// CK9: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]],
475// CK9: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i[[sz]] 0, i[[sz]] 0
476#endif
477///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000478// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK10
479// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
480// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK10
481// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK10
482// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
483// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK10
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000484#ifdef CK10
485
Samuel Antao6782e942016-05-26 16:48:10 +0000486// CK10-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] zeroinitializer
487// Map types: OMP_MAP_IS_FIRST = 32
488// CK10-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 32]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000489
490// CK10-LABEL: implicit_maps_pointer
491void implicit_maps_pointer (){
492 double *ddyn;
493
494 // CK10-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
495 // CK10-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
496 // CK10-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
497 // CK10-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
498 // CK10-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
499 // CK10-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
500 // CK10-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
501 // CK10-DAG: [[VALBP]] = bitcast double* [[PTR:%.+]] to i8*
502 // CK10-DAG: [[VALP]] = bitcast double* [[PTR]] to i8*
503
504 // CK10: call void [[KERNEL:@.+]](double* [[PTR]])
505 #pragma omp target
506 {
507 ddyn[0] += 1.0;
508 ddyn[1] += 1.0;
509 }
510}
511
512// CK10: define internal void [[KERNEL]](double* {{.*}}[[ARG:%.+]])
513// CK10: [[ADDR:%.+]] = alloca double*,
514// CK10: store double* [[ARG]], double** [[ADDR]],
515// CK10: [[REF:%.+]] = load double*, double** [[ADDR]],
516// CK10: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] 0
517
518#endif
519///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000520// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK11
521// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
522// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK11
523// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK11
524// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
525// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK11
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000526#ifdef CK11
527
528// CK11-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 16]
Samuel Antao6782e942016-05-26 16:48:10 +0000529// Map types: OMP_MAP_TO + OMP_MAP_IS_FIRST = 33
530// CK11-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000531
532// CK11-LABEL: implicit_maps_double_complex
533void implicit_maps_double_complex (int a){
534 double _Complex dc = (double)a;
535
536 // CK11-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
537 // CK11-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
538 // CK11-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
539 // CK11-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
540 // CK11-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
541 // CK11-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
542 // CK11-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
543 // CK11-DAG: [[VALBP]] = bitcast { double, double }* [[PTR:%.+]] to i8*
544 // CK11-DAG: [[VALP]] = bitcast { double, double }* [[PTR]] to i8*
545
546 // CK11: call void [[KERNEL:@.+]]({ double, double }* [[PTR]])
547 #pragma omp target
548 {
549 dc *= dc;
550 }
551}
552
553// CK11: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]])
554// CK11: [[ADDR:%.+]] = alloca { double, double }*,
555// CK11: store { double, double }* [[ARG]], { double, double }** [[ADDR]],
556// CK11: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]],
557// CK11: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0
558#endif
559///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000560// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-64
561// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
562// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-64
563// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-32
564// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
565// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK12 --check-prefix CK12-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000566#ifdef CK12
567
568// For a 32-bit targets, the value doesn't fit the size of the pointer,
569// therefore it is passed by reference with a map 'to' specification.
570
571// CK12-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 8]
Samuel Antao6782e942016-05-26 16:48:10 +0000572// Map types: OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
573// CK12-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
574// Map types: OMP_MAP_TO + OMP_MAP_IS_FIRST = 33
575// CK12-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 33]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000576
577// CK12-LABEL: implicit_maps_float_complex
578void implicit_maps_float_complex (int a){
579 float _Complex fc = (float)a;
580
581 // CK12-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
582 // CK12-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
583 // CK12-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
584 // CK12-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
585 // CK12-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
586
587 // CK12-64-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
588 // CK12-64-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
589 // CK12-64-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
590 // CK12-64-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
591 // CK12-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
592 // CK12-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
593 // CK12-64-DAG: store { float, float } {{.+}}, { float, float }* [[CADDR]],
594
595 // CK12-32-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
596 // CK12-32-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
597 // CK12-32-DAG: [[VALBP]] = bitcast { float, float }* [[DECL:%.+]] to i8*
598 // CK12-32-DAG: [[VALP]] = bitcast { float, float }* [[DECL]] to i8*
599
600 // CK12-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
601 // CK12-32: call void [[KERNEL:@.+]]({ float, float }* [[DECL]])
602 #pragma omp target
603 {
604 fc *= fc;
605 }
606}
607
608// CK12-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
609// CK12-64: [[ADDR:%.+]] = alloca i[[sz]],
610// CK12-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
611// CK12-64: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to { float, float }*
612// CK12-64: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[CADDR]], i32 0, i32 0
613
614// CK12-32: define internal void [[KERNEL]]({ float, float }* {{.+}}[[ARG:%.+]])
615// CK12-32: [[ADDR:%.+]] = alloca { float, float }*,
616// CK12-32: store { float, float }* [[ARG]], { float, float }** [[ADDR]],
617// CK12-32: [[REF:%.+]] = load { float, float }*, { float, float }** [[ADDR]],
618// CK12-32: {{.+}} = getelementptr inbounds { float, float }, { float, float }* [[REF]], i32 0, i32 0
619#endif
620///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000621// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK13
622// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
623// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK13
624// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK13
625// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
626// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK13
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000627#ifdef CK13
628
629// We don't have a constant map size for VLAs.
630// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000631// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
632// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288 (vla size)
633// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
634// CK13-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000635
636// CK13-LABEL: implicit_maps_variable_length_array
637void implicit_maps_variable_length_array (int a){
638 double vla[2][a];
639
640 // CK13-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i[[sz:64|32]]* [[SGEP:%[^,]+]], {{.+}}[[TYPES]]{{.+}})
641 // CK13-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
642 // CK13-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
643 // CK13-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SS:%[^,]+]], i32 0, i32 0
644
645 // CK13-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
646 // CK13-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
647 // CK13-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 0
648 // CK13-DAG: store i8* inttoptr (i[[sz]] 2 to i8*), i8** [[BP0]],
649 // CK13-DAG: store i8* inttoptr (i[[sz]] 2 to i8*), i8** [[P0]],
650 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S0]],
651
652 // CK13-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
653 // CK13-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
654 // CK13-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1
655 // CK13-DAG: store i8* [[VALBP1:%.+]], i8** [[BP1]],
656 // CK13-DAG: store i8* [[VALP1:%.+]], i8** [[P1]],
657 // CK13-DAG: [[VALBP1]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
658 // CK13-DAG: [[VALP1]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
659 // CK13-DAG: store i[[sz]] {{8|4}}, i[[sz]]* [[S1]],
660
661 // CK13-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2
662 // CK13-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2
663 // CK13-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2
664 // CK13-DAG: store i8* [[VALBP2:%.+]], i8** [[BP2]],
665 // CK13-DAG: store i8* [[VALP2:%.+]], i8** [[P2]],
666 // CK13-DAG: store i[[sz]] [[VALS2:%.+]], i[[sz]]* [[S2]],
667 // CK13-DAG: [[VALBP2]] = bitcast double* [[DECL:%.+]] to i8*
668 // CK13-DAG: [[VALP2]] = bitcast double* [[DECL]] to i8*
669 // CK13-DAG: [[VALS2]] = mul nuw i[[sz]] %{{.+}}, 8
670
671 // CK13: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]])
672 #pragma omp target
673 {
674 vla[1][3] += 1.0;
675 }
676}
677
Alexey Bataev2f5ed342016-10-13 09:52:46 +0000678// CK13: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]])
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000679// CK13: [[ADDR0:%.+]] = alloca i[[sz]],
680// CK13: [[ADDR1:%.+]] = alloca i[[sz]],
681// CK13: [[ADDR2:%.+]] = alloca double*,
682// CK13: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]],
683// CK13: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]],
684// CK13: store double* [[ARG]], double** [[ADDR2]],
685// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR0]],
686// CK13: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR1]],
687// CK13: [[REF:%.+]] = load double*, double** [[ADDR2]],
688// CK13: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}}
689#endif
690///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000691// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-64
692// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
693// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-64
694// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-32
695// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
696// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK14 --check-prefix CK14-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000697#ifdef CK14
698
699// CK14-DAG: [[ST:%.+]] = type { i32, double }
700// CK14-DAG: [[SIZES:@.+]] = {{.+}}constant [2 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}, i{{64|32}} 4]
701// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000702// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
703// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
704// CK14-DAG: [[TYPES:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000705
706class SSS {
707public:
708 int a;
709 double b;
710
711 void foo(int c) {
712 #pragma omp target
713 {
714 a += c;
715 b += (double)c;
716 }
717 }
718
719 SSS(int a, double b) : a(a), b(b) {}
720};
721
722// CK14-LABEL: implicit_maps_class
723void implicit_maps_class (int a){
724 SSS sss(a, (double)a);
725
726 // CK14: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
727 // CK14-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
728 // CK14-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
729 // CK14-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
730
731 // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
732 // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
733 // CK14-DAG: store i8* [[VALBP0:%.+]], i8** [[BP0]],
734 // CK14-DAG: store i8* [[VALP0:%.+]], i8** [[P0]],
735 // CK14-DAG: [[VALBP0]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
736 // CK14-DAG: [[VALP0]] = bitcast [[ST]]* [[DECL]] to i8*
737
738 // CK14-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
739 // CK14-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
740 // CK14-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
741 // CK14-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
742 // CK14-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
743 // CK14-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
744 // CK14-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
745 // CK14-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
746 // CK14-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
747
748 // CK14: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
749 sss.foo(123);
750}
751
752// CK14: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
753// CK14: [[ADDR0:%.+]] = alloca [[ST]]*,
754// CK14: [[ADDR1:%.+]] = alloca i[[sz]],
755// CK14: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
756// CK14: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
757// CK14: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
758// CK14-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
759// CK14-64: {{.+}} = load i32, i32* [[CADDR1]],
760// CK14-32: {{.+}} = load i32, i32* [[ADDR1]],
761// CK14: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
762
763#endif
764///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000765// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-64
766// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
767// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-64
768// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-32
769// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
770// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK15 --check-prefix CK15-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000771#ifdef CK15
772
773// CK15: [[ST:%.+]] = type { i32, double, i32* }
774// CK15: [[SIZES:@.+]] = {{.+}}constant [2 x i[[sz:64|32]]] [i{{64|32}} {{24|16}}, i{{64|32}} 4]
775// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000776// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
777// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
778// CK15: [[TYPES:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000779
780// CK15: [[SIZES2:@.+]] = {{.+}}constant [2 x i[[sz]]] [i{{64|32}} {{24|16}}, i{{64|32}} 4]
781// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000782// - OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
783// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
784// CK15: [[TYPES2:@.+]] = {{.+}}constant [2 x i32] [i32 35, i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000785
786template<int x>
787class SSST {
788public:
789 int a;
790 double b;
791 int &r;
792
793 void foo(int c) {
794 #pragma omp target
795 {
796 a += c + x;
797 b += (double)(c + x);
798 r += x;
799 }
800 }
801 template<int y>
802 void bar(int c) {
803 #pragma omp target
804 {
805 a += c + x + y;
806 b += (double)(c + x + y);
807 r += x + y;
808 }
809 }
810
811 SSST(int a, double b, int &r) : a(a), b(b), r(r) {}
812};
813
814// CK15-LABEL: implicit_maps_templated_class
815void implicit_maps_templated_class (int a){
816 SSST<123> ssst(a, (double)a, a);
817
818 // CK15: define {{.*}}void @{{.+}}foo{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
819 // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
820 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
821 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
822
823 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
824 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
825 // CK15-DAG: store i8* [[VALBP0:%.+]], i8** [[BP0]],
826 // CK15-DAG: store i8* [[VALP0:%.+]], i8** [[P0]],
827 // CK15-DAG: [[VALBP0]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
828 // CK15-DAG: [[VALP0]] = bitcast [[ST]]* [[DECL]] to i8*
829
830 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
831 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
832 // CK15-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
833 // CK15-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
834 // CK15-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
835 // CK15-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
836 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
837 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
838 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
839
840 // CK15: call void [[KERNEL:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
841 ssst.foo(456);
842
843 // CK15: define {{.*}}void @{{.+}}bar{{.+}}([[ST]]* {{[^,]+}}, i32 {{[^,]+}})
844 // CK15-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES2]]{{.+}}, {{.+}}[[TYPES2]]{{.+}})
845 // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
846 // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
847
848 // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
849 // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
850 // CK15-DAG: store i8* [[VALBP0:%.+]], i8** [[BP0]],
851 // CK15-DAG: store i8* [[VALP0:%.+]], i8** [[P0]],
852 // CK15-DAG: [[VALBP0]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
853 // CK15-DAG: [[VALP0]] = bitcast [[ST]]* [[DECL]] to i8*
854
855 // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1
856 // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1
857 // CK15-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
858 // CK15-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
859 // CK15-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
860 // CK15-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
861 // CK15-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
862 // CK15-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
863 // CK15-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
864
865 // CK15: call void [[KERNEL2:@.+]]([[ST]]* [[DECL]], i[[sz]] {{.+}})
866 ssst.bar<210>(789);
867}
868
869// CK15: define internal void [[KERNEL]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
870// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
871// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
872// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
873// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
874// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
875// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
876// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
877// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
878// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
879
880// CK15: define internal void [[KERNEL2]]([[ST]]* [[THIS:%.+]], i[[sz]] [[ARG:%.+]])
881// CK15: [[ADDR0:%.+]] = alloca [[ST]]*,
882// CK15: [[ADDR1:%.+]] = alloca i[[sz]],
883// CK15: store [[ST]]* [[THIS]], [[ST]]** [[ADDR0]],
884// CK15: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR1]],
885// CK15: [[REF0:%.+]] = load [[ST]]*, [[ST]]** [[ADDR0]],
886// CK15-64: [[CADDR1:%.+]] = bitcast i[[sz]]* [[ADDR1]] to i32*
887// CK15-64: {{.+}} = load i32, i32* [[CADDR1]],
888// CK15-32: {{.+}} = load i32, i32* [[ADDR1]],
889// CK15: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF0]], i32 0, i32 0
890
891#endif
892///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000893// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-64
894// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
895// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-64
896// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-32
897// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
898// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK16 --check-prefix CK16-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000899#ifdef CK16
900
901// CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
902// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +0000903// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
904// CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000905
906template<int y>
907int foo(int d) {
908 int res = d;
909 #pragma omp target
910 {
911 res += y;
912 }
913 return res;
914}
915// CK16-LABEL: implicit_maps_templated_function
916void implicit_maps_templated_function (int a){
917 int i = a;
918
919 // CK16: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
920 // CK16-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
921 // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
922 // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
923
924 // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
925 // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
926 // CK16-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
927 // CK16-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
928 // CK16-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
929 // CK16-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
930 // CK16-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
931 // CK16-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
932 // CK16-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
933
934 // CK16: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
935 i = foo<543>(i);
936}
937// CK16: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
938// CK16: [[ADDR:%.+]] = alloca i[[sz]],
939// CK16: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
940// CK16-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
941// CK16-64: {{.+}} = load i32, i32* [[CADDR]],
942// CK16-32: {{.+}} = load i32, i32* [[ADDR]],
943
944#endif
945///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000946// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK17
947// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
948// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK17
949// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK17
950// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
951// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK17
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000952#ifdef CK17
953
954// CK17-DAG: [[ST:%.+]] = type { i32, double }
955// CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} {{16|12}}]
Samuel Antao6782e942016-05-26 16:48:10 +0000956// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_IS_FIRST = 35
957// CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 35]
Samuel Antao4af1b7b2015-12-02 17:44:43 +0000958
959class SSS {
960public:
961 int a;
962 double b;
963};
964
965// CK17-LABEL: implicit_maps_struct
966void implicit_maps_struct (int a){
967 SSS s = {a, (double)a};
968
969 // CK17-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
970 // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
971 // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
972 // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
973 // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
974 // CK17-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
975 // CK17-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
976 // CK17-DAG: [[VALBP]] = bitcast [[ST]]* [[DECL:%.+]] to i8*
977 // CK17-DAG: [[VALP]] = bitcast [[ST]]* [[DECL]] to i8*
978
979 // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]])
980 #pragma omp target
981 {
982 s.a += 1;
983 s.b += 1.0;
984 }
985}
986
987// CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]])
988// CK17: [[ADDR:%.+]] = alloca [[ST]]*,
989// CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]],
990// CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]],
991// CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0
992#endif
993///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +0000994// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-64
995// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
996// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-64
997// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-32
998// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
999// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK18 --check-prefix CK18-32
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001000#ifdef CK18
1001
1002// CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4]
1003// Map types:
Samuel Antao6782e942016-05-26 16:48:10 +00001004// - OMP_MAP_PRIVATE_VAL + OMP_MAP_IS_FIRST = 288
1005// CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288]
Samuel Antao4af1b7b2015-12-02 17:44:43 +00001006
1007template<typename T>
1008int foo(T d) {
1009 #pragma omp target
1010 {
1011 d += (T)1;
1012 }
1013 return d;
1014}
1015// CK18-LABEL: implicit_maps_template_type_capture
1016void implicit_maps_template_type_capture (int a){
1017 int i = a;
1018
1019 // CK18: define {{.*}}i32 @{{.+}}foo{{.+}}(i32 {{[^,]+}})
1020 // CK18-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}})
1021 // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
1022 // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
1023
1024 // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
1025 // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
1026 // CK18-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
1027 // CK18-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
1028 // CK18-DAG: [[VALBP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
1029 // CK18-DAG: [[VALP]] = inttoptr i[[sz]] [[VAL:%.+]] to i8*
1030 // CK18-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]],
1031 // CK18-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to i32*
1032 // CK18-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
1033
1034 // CK18: call void [[KERNEL:@.+]](i[[sz]] [[VAL]])
1035 i = foo(i);
1036}
1037// CK18: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]])
1038// CK18: [[ADDR:%.+]] = alloca i[[sz]],
1039// CK18: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]],
1040// CK18-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to i32*
1041// CK18-64: {{.+}} = load i32, i32* [[CADDR]],
1042// CK18-32: {{.+}} = load i32, i32* [[ADDR]],
1043
1044#endif
Samuel Antao86ace552016-04-27 22:40:57 +00001045///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00001046// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-64
1047// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
1048// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-64
1049// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-32
1050// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
1051// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK19 --check-prefix CK19-32
Samuel Antao86ace552016-04-27 22:40:57 +00001052#ifdef CK19
1053
1054// CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001055// CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001056
1057// CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00001058// CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001059
1060// CK19: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001061// CK19: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001062
1063// CK19: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001064// CK19: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001065
1066// CK19: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00001067// CK19: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001068
1069// CK19: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001070// CK19: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001071
Samuel Antao6782e942016-05-26 16:48:10 +00001072// CK19: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001073
Samuel Antao6782e942016-05-26 16:48:10 +00001074// CK19: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001075
1076// CK19: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001077// CK19: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001078
1079// CK19: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00001080// CK19: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001081
1082// CK19: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001083// CK19: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001084
1085// CK19: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001086// CK19: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001087
1088// CK19: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001089// CK19: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001090
Samuel Antao6782e942016-05-26 16:48:10 +00001091// CK19: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001092
Samuel Antao6782e942016-05-26 16:48:10 +00001093// CK19: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001094
1095// CK19: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001096// CK19: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001097
Samuel Antao6782e942016-05-26 16:48:10 +00001098// CK19: [[MTYPE16:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001099
1100// CK19: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001101// CK19: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00001102
1103// CK19: [[SIZE18:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 240]
Samuel Antao6782e942016-05-26 16:48:10 +00001104// CK19: [[MTYPE18:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001105
Samuel Antao6782e942016-05-26 16:48:10 +00001106// CK19: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 32]
Samuel Antao86ace552016-04-27 22:40:57 +00001107
1108// CK19: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001109// CK19: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00001110
Samuel Antao6782e942016-05-26 16:48:10 +00001111// CK19: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001112
1113// CK19: [[SIZE22:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001114// CK19: [[MTYPE22:@.+]] = private {{.*}}constant [2 x i32] [i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001115
1116// CK19: [[SIZE23:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001117// CK19: [[MTYPE23:@.+]] = private {{.*}}constant [1 x i32] [i32 39]
Samuel Antao86ace552016-04-27 22:40:57 +00001118
1119// CK19: [[SIZE24:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 480]
Samuel Antao6782e942016-05-26 16:48:10 +00001120// CK19: [[MTYPE24:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001121
1122// CK19: [[SIZE25:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00001123// CK19: [[MTYPE25:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001124
1125// CK19: [[SIZE26:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 24]
Samuel Antao6782e942016-05-26 16:48:10 +00001126// CK19: [[MTYPE26:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001127
1128// CK19: [[SIZE27:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00001129// CK19: [[MTYPE27:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001130
1131// 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 +00001132// CK19: [[MTYPE28:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001133
1134// 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 +00001135// CK19: [[MTYPE29:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001136
Samuel Antao6782e942016-05-26 16:48:10 +00001137// CK19: [[MTYPE30:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001138
1139// 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 +00001140// CK19: [[MTYPE31:@.+]] = private {{.*}}constant [4 x i32] [i32 288, i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001141
1142// CK19: [[SIZE32:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001143// CK19: [[MTYPE32:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001144
1145// CK19: [[SIZE33:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001146// CK19: [[MTYPE33:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001147
1148// CK19: [[SIZE34:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 13728]
Samuel Antao6782e942016-05-26 16:48:10 +00001149// CK19: [[MTYPE34:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001150
Samuel Antao6782e942016-05-26 16:48:10 +00001151// CK19: [[MTYPE35:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001152
1153// CK19: [[SIZE36:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 208]
Samuel Antao6782e942016-05-26 16:48:10 +00001154// CK19: [[MTYPE36:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001155
Samuel Antao6782e942016-05-26 16:48:10 +00001156// CK19: [[MTYPE37:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001157
Samuel Antao6782e942016-05-26 16:48:10 +00001158// CK19: [[MTYPE38:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001159
Samuel Antao6782e942016-05-26 16:48:10 +00001160// CK19: [[MTYPE39:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001161
Samuel Antao6782e942016-05-26 16:48:10 +00001162// CK19: [[MTYPE40:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001163
1164// 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 +00001165// CK19: [[MTYPE41:@.+]] = private {{.*}}constant [3 x i32] [i32 288, i32 288, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001166
1167// 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 +00001168// CK19: [[MTYPE42:@.+]] = private {{.*}}constant [3 x i32] [i32 35, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00001169
Samuel Antao6782e942016-05-26 16:48:10 +00001170// CK19: [[MTYPE43:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00001171
1172// CK19-LABEL: explicit_maps_single
1173void explicit_maps_single (int ii){
1174 // Map of a scalar.
1175 int a = ii;
1176
1177 // Region 00
1178 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
1179 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1180 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1181
1182 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1183 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1184 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1185 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1186 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
1187 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
1188
1189 // CK19: call void [[CALL00:@.+]](i32* {{[^,]+}})
1190 #pragma omp target map(alloc:a)
1191 {
1192 ++a;
1193 }
1194
1195 // Map of an array.
1196 int arra[100];
1197
1198 // Region 01
1199 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
1200 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1201 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1202
1203 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1204 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1205 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1206 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1207 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1208 // CK19-DAG: [[CPVAL0]] = bitcast [100 x i32]* [[VAR0]] to i8*
1209
1210 // CK19: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
1211 #pragma omp target map(to:arra)
1212 {
1213 arra[50]++;
1214 }
1215
1216 // Region 02
1217 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
1218 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1219 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1220
1221 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1222 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1223 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1224 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1225 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1226 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1227 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 20
1228
1229 // CK19: call void [[CALL02:@.+]]([100 x i32]* {{[^,]+}})
1230 #pragma omp target map(from:arra[20:60])
1231 {
1232 arra[50]++;
1233 }
1234
1235 // Region 03
1236 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
1237 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1238 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1239
1240 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1241 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1242 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1243 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1244 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1245 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1246 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1247
1248 // CK19: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
1249 #pragma omp target map(tofrom:arra[:60])
1250 {
1251 arra[50]++;
1252 }
1253
1254 // Region 04
1255 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
1256 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1257 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1258
1259 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1260 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1261 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1262 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1263 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1264 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1265 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1266
1267 // CK19: call void [[CALL04:@.+]]([100 x i32]* {{[^,]+}})
1268 #pragma omp target map(alloc:arra[:])
1269 {
1270 arra[50]++;
1271 }
1272
1273 // Region 05
1274 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
1275 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1276 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1277
1278 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1279 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1280 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1281 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1282 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1283 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1284 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 15
1285
1286 // CK19: call void [[CALL05:@.+]]([100 x i32]* {{[^,]+}})
1287 #pragma omp target map(to:arra[15])
1288 {
1289 arra[15]++;
1290 }
1291
1292 // Region 06
1293 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
1294 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1295 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1296 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1297
1298 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1299 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1300 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1301 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1302 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1303 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1304 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1305 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1306 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1307 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1308
1309 // CK19: call void [[CALL06:@.+]]([100 x i32]* {{[^,]+}})
1310 #pragma omp target map(tofrom:arra[ii:ii+23])
1311 {
1312 arra[50]++;
1313 }
1314
1315 // Region 07
1316 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
1317 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1318 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1319 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1320
1321 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1322 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1323 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1324 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1325 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1326 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1327 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1328 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1329 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1330 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
1331
1332 // CK19: call void [[CALL07:@.+]]([100 x i32]* {{[^,]+}})
1333 #pragma omp target map(alloc:arra[:ii])
1334 {
1335 arra[50]++;
1336 }
1337
1338 // Region 08
1339 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
1340 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1341 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1342
1343 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1344 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1345 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1346 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1347 // CK19-DAG: [[CBPVAL0]] = bitcast [100 x i32]* [[VAR0:%.+]] to i8*
1348 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1349 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[100 x i32]* [[VAR0]], i{{.+}} 0, i{{.+}} %{{.*}}
1350
1351 // CK19: call void [[CALL08:@.+]]([100 x i32]* {{[^,]+}})
1352 #pragma omp target map(tofrom:arra[ii])
1353 {
1354 arra[15]++;
1355 }
1356
1357 // Map of a pointer.
1358 int *pa;
1359
1360 // Region 09
1361 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
1362 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1363 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1364
1365 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1366 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1367 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1368 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1369 // CK19-DAG: [[CBPVAL0]] = bitcast i32** [[VAR0:%.+]] to i8*
1370 // CK19-DAG: [[CPVAL0]] = bitcast i32** [[VAR0]] to i8*
1371
1372 // CK19: call void [[CALL09:@.+]](i32** {{[^,]+}})
1373 #pragma omp target map(from:pa)
1374 {
1375 pa[50]++;
1376 }
1377
1378 // Region 10
1379 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
1380 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1381 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1382
1383 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1384 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1385 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1386 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1387 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1388 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1389 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1390 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 20
1391 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1392
1393 // CK19: call void [[CALL10:@.+]](i32* {{[^,]+}})
1394 #pragma omp target map(tofrom:pa[20:60])
1395 {
1396 pa[50]++;
1397 }
1398
1399 // Region 11
1400 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
1401 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1402 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1403
1404 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1405 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1406 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1407 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1408 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1409 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1410 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1411 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1412 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1413
1414 // CK19: call void [[CALL11:@.+]](i32* {{[^,]+}})
1415 #pragma omp target map(alloc:pa[:60])
1416 {
1417 pa[50]++;
1418 }
1419
1420 // Region 12
1421 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
1422 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1423 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1424
1425 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1426 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1427 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1428 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1429 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1430 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1431 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1432 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 15
1433 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1434
1435 // CK19: call void [[CALL12:@.+]](i32* {{[^,]+}})
1436 #pragma omp target map(to:pa[15])
1437 {
1438 pa[15]++;
1439 }
1440
1441 // Region 13
1442 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
1443 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1444 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1445 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1446
1447 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1448 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1449 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1450 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1451 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1452 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1453 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1454 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1455 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1456 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1457 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1458 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1459
1460 // CK19: call void [[CALL13:@.+]](i32* {{[^,]+}})
1461 #pragma omp target map(alloc:pa[ii-23:ii])
1462 {
1463 pa[50]++;
1464 }
1465
1466 // Region 14
1467 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
1468 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1469 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1470 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1471
1472 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1473 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1474 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1475 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1476 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1477 // CK19-DAG: store i{{.+}} [[CSVAL0:%[^,]+]], i{{.+}}* [[S0]]
1478 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1479 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1480 // CK19-DAG: [[CSVAL0]] = mul nuw i{{.+}} %{{.*}}, 4
1481 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1482 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
1483 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1484
1485 // CK19: call void [[CALL14:@.+]](i32* {{[^,]+}})
1486 #pragma omp target map(to:pa[:ii])
1487 {
1488 pa[50]++;
1489 }
1490
1491 // Region 15
1492 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
1493 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1494 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1495
1496 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1497 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1498 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1499 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1500 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
1501 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1502 // CK19-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
1503 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.*}}
1504 // CK19-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
1505
1506 // CK19: call void [[CALL15:@.+]](i32* {{[^,]+}})
1507 #pragma omp target map(from:pa[ii+12])
1508 {
1509 pa[15]++;
1510 }
1511
1512 // Map of a variable-size array.
1513 int va[ii];
1514
1515 // Region 16
1516 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE16]]{{.+}})
1517 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1518 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1519 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1520
1521 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1522 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1523 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1524 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1525 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1526 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
1527 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1528 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1529
1530 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1531 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1532 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1533 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1534 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1535 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
1536 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1537 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[VAR1]] to i8*
1538 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1539
1540 // CK19: call void [[CALL16:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1541 #pragma omp target map(to:va)
1542 {
1543 va[50]++;
1544 }
1545
1546 // Region 17
1547 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
1548 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1549 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1550
1551 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1552 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1553 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1554 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1555 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1556 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1557
1558 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1559 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1560 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1561 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1562 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1563 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1564 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 20
1565
1566 // CK19: call void [[CALL17:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1567 #pragma omp target map(from:va[20:60])
1568 {
1569 va[50]++;
1570 }
1571
1572 // Region 18
1573 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE18]]{{.+}})
1574 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1575 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1576
1577 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1578 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1579 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1580 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1581 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1582 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1583
1584 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1585 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1586 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1587 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1588 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1589 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1590 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1591
1592 // CK19: call void [[CALL18:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1593 #pragma omp target map(tofrom:va[:60])
1594 {
1595 va[50]++;
1596 }
1597
1598 // Region 19
1599 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
1600 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1601 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1602 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1603
1604 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1605 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1606 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1607 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1608 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1609 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
1610 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1611 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1612
1613 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1614 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1615 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1616 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1617 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1618 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
1619 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1620 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1621 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1622 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 0
1623
1624 // CK19: call void [[CALL19:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1625 #pragma omp target map(alloc:va[:])
1626 {
1627 va[50]++;
1628 }
1629
1630 // Region 20
1631 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
1632 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1633 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1634
1635 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1636 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1637 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1638 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1639 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1640 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1641
1642 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1643 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1644 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1645 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1646 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1647 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1648 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} 15
1649
1650 // CK19: call void [[CALL20:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1651 #pragma omp target map(to:va[15])
1652 {
1653 va[15]++;
1654 }
1655
1656 // Region 21
1657 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
1658 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1659 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1660 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1661
1662 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1663 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1664 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1665 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1666 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1667 // CK19-DAG: store i{{.+}} {{8|4}}, i{{.+}}* [[S0]]
1668 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1669 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1670
1671 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1672 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1673 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1674 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1675 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1676 // CK19-DAG: store i{{.+}} [[CSVAL1:%[^,]+]], i{{.+}}* [[S1]]
1677 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1678 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1679 // CK19-DAG: [[CSVAL1]] = mul nuw i{{.+}} %{{.*}}, 4
1680 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1681
1682 // CK19: call void [[CALL21:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1683 #pragma omp target map(tofrom:va[ii:ii+23])
1684 {
1685 va[50]++;
1686 }
1687
1688 // Region 22
1689 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE22]]{{.+}})
1690 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1691 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1692
1693 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1694 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1695 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1696 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1697 // CK19-DAG: [[CBPVAL0]] = inttoptr i[[Z]] %{{.+}} to i8*
1698 // CK19-DAG: [[CPVAL0]] = inttoptr i[[Z]] %{{.+}}to i8*
1699
1700 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1701 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1702 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1703 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1704 // CK19-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
1705 // CK19-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
1706 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32* [[VAR1]], i{{.+}} %{{.+}}
1707
1708 // CK19: call void [[CALL22:@.+]](i{{.+}} {{[^,]+}}, i32* {{[^,]+}})
1709 #pragma omp target map(tofrom:va[ii])
1710 {
1711 va[15]++;
1712 }
1713
1714 // Always.
1715 // Region 23
1716 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE23]]{{.+}})
1717 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1718 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1719
1720 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1721 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1722 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1723 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1724 // CK19-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
1725 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
1726
1727 // CK19: call void [[CALL23:@.+]](i32* {{[^,]+}})
1728 #pragma omp target map(always, tofrom: a)
1729 {
1730 a++;
1731 }
1732
1733 // Multidimensional arrays.
1734 int marr[4][5][6];
1735 int ***mptr;
1736
1737 // Region 24
1738 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE24]]{{.+}})
1739 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1740 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1741
1742 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1743 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1744 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1745 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1746 // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1747 // CK19-DAG: [[CPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0]] to i8*
1748
1749 // CK19: call void [[CALL24:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1750 #pragma omp target map(tofrom: marr)
1751 {
1752 marr[1][2][3]++;
1753 }
1754
1755 // Region 25
1756 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE25]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE25]]{{.+}})
1757 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1758 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1759
1760 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1761 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1762 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1763 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1764 // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1765 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1766 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 2
1767 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1768 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1769
1770 // CK19: call void [[CALL25:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1771 #pragma omp target map(tofrom: marr[1][2][2:4])
1772 {
1773 marr[1][2][3]++;
1774 }
1775
1776 // Region 26
1777 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE26]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE26]]{{.+}})
1778 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1779 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1780
1781 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1782 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1783 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1784 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1785 // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1786 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1787 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 0
1788 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1789 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1790
1791 // CK19: call void [[CALL26:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1792 #pragma omp target map(tofrom: marr[1][2][:])
1793 {
1794 marr[1][2][3]++;
1795 }
1796
1797 // Region 27
1798 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE27]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE27]]{{.+}})
1799 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1800 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1801
1802 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1803 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1804 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1805 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1806 // CK19-DAG: [[CBPVAL0]] = bitcast [4 x [5 x [6 x i32]]]* [[VAR0:%.+]] to i8*
1807 // CK19-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
1808 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}[6 x i32]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 3
1809 // CK19-DAG: [[SEC00]] = getelementptr {{.*}}[5 x [6 x i32]]* [[SEC000:[^,]+]], i{{.+}} 0, i{{.+}} 2
1810 // CK19-DAG: [[SEC000]] = getelementptr {{.*}}[4 x [5 x [6 x i32]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
1811
1812 // CK19: call void [[CALL27:@.+]]([4 x [5 x [6 x i32]]]* {{[^,]+}})
1813 #pragma omp target map(tofrom: marr[1][2][3])
1814 {
1815 marr[1][2][3]++;
1816 }
1817
1818 // Region 28
1819 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE28]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE28]]{{.+}})
1820 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1821 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1822
1823 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1824 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1825 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1826 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1827 // CK19-DAG: [[CBPVAL0]] = bitcast i32*** [[VAR0:%.+]] to i8*
1828 // CK19-DAG: [[CPVAL0]] = bitcast i32*** [[SEC0:%.+]] to i8*
1829 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1830 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1831 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1832
1833 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1834 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1835 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1836 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1837 // CK19-DAG: [[CBPVAL1]] = bitcast i32*** [[SEC0]] to i8*
1838 // CK19-DAG: [[CPVAL1]] = bitcast i32** [[SEC1:%.+]] to i8*
1839 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1840 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1841 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1842 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1843
1844 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1845 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1846 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1847 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1848 // CK19-DAG: [[CBPVAL2]] = bitcast i32** [[SEC1]] to i8*
1849 // CK19-DAG: [[CPVAL2]] = bitcast i32* [[SEC2:%.+]] to i8*
1850 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 2
1851 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1852 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1853 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1854 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1855 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1856
1857 // CK19: call void [[CALL28:@.+]](i32*** {{[^,]+}})
1858 #pragma omp target map(tofrom: mptr[1][2][2:4])
1859 {
1860 mptr[1][2][3]++;
1861 }
1862
1863 // Region 29
1864 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE29]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE29]]{{.+}})
1865 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1866 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1867
1868 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1869 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1870 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
1871 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
1872 // CK19-DAG: [[CBPVAL0]] = bitcast i32*** [[VAR0:%.+]] to i8*
1873 // CK19-DAG: [[CPVAL0]] = bitcast i32*** [[SEC0:%.+]] to i8*
1874 // CK19-DAG: [[VAR0]] = load i32***, i32**** [[PTR:%[^,]+]],
1875 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}i32*** [[SEC00:[^,]+]], i{{.+}} 1
1876 // CK19-DAG: [[SEC00]] = load i32***, i32**** [[PTR]],
1877
1878 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1879 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1880 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1881 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1882 // CK19-DAG: [[CBPVAL1]] = bitcast i32*** [[SEC0]] to i8*
1883 // CK19-DAG: [[CPVAL1]] = bitcast i32** [[SEC1:%.+]] to i8*
1884 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}i32** [[SEC11:[^,]+]], i{{.+}} 2
1885 // CK19-DAG: [[SEC11]] = load i32**, i32*** [[SEC111:%[^,]+]],
1886 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}i32*** [[SEC1111:[^,]+]], i{{.+}} 1
1887 // CK19-DAG: [[SEC1111]] = load i32***, i32**** [[PTR]],
1888
1889 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1890 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1891 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1892 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1893 // CK19-DAG: [[CBPVAL2]] = bitcast i32** [[SEC1]] to i8*
1894 // CK19-DAG: [[CPVAL2]] = bitcast i32* [[SEC2:%.+]] to i8*
1895 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}i32* [[SEC22:[^,]+]], i{{.+}} 3
1896 // CK19-DAG: [[SEC22]] = load i32*, i32** [[SEC222:%[^,]+]],
1897 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}i32** [[SEC2222:[^,]+]], i{{.+}} 2
1898 // CK19-DAG: [[SEC2222]] = load i32**, i32*** [[SEC22222:%[^,]+]],
1899 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}i32*** [[SEC222222:[^,]+]], i{{.+}} 1
1900 // CK19-DAG: [[SEC222222]] = load i32***, i32**** [[PTR]],
1901
1902 // CK19: call void [[CALL29:@.+]](i32*** {{[^,]+}})
1903 #pragma omp target map(tofrom: mptr[1][2][3])
1904 {
1905 mptr[1][2][3]++;
1906 }
1907
1908 // Multidimensional VLA.
1909 double mva[23][ii][ii+5];
1910
1911 // Region 30
1912 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE30]]{{.+}})
1913 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1914 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1915 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
1916 //
1917 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1918 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1919 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
1920 // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[BP0]]
1921 // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[P0]]
1922 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
1923 //
1924 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1925 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1926 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
1927 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1928 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1929 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
1930 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
1931 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
1932 // CK19-64-DAG: [[VAR1]] = zext i32 %{{[^,]+}} to i64
1933 // CK19-64-DAG: [[VAR11]] = zext i32 %{{[^,]+}} to i64
1934 //
1935 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1936 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1937 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
1938 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1939 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1940 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S2]]
1941 // CK19-DAG: [[CBPVAL2]] = inttoptr i[[Z]] [[VAR2:%.+]] to i8*
1942 // CK19-DAG: [[CPVAL2]] = inttoptr i[[Z]] [[VAR22:%.+]] to i8*
1943 // CK19-64-DAG: [[VAR2]] = zext i32 %{{[^,]+}} to i64
1944 // CK19-64-DAG: [[VAR22]] = zext i32 %{{[^,]+}} to i64
1945 //
1946 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1947 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
1948 // CK19-DAG: [[S3:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 3
1949 // CK19-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
1950 // CK19-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
1951 // CK19-DAG: store i[[Z]] [[CSVAL3:%[^,]+]], i[[Z]]* [[S3]]
1952 // CK19-DAG: [[CBPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
1953 // CK19-DAG: [[CPVAL3]] = bitcast double* [[VAR3]] to i8*
1954 // CK19-DAG: [[CSVAL3]] = mul nuw i[[Z]] %{{[^,]+}}, {{8|4}}
1955
1956 // CK19: call void [[CALL30:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
1957 #pragma omp target map(tofrom: mva)
1958 {
1959 mva[1][2][3]++;
1960 }
1961
1962 // Region 31
1963 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE31]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE31]]{{.+}})
1964 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
1965 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
1966 //
1967 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
1968 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
1969 // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[BP0]]
1970 // CK19-DAG: store i8* inttoptr (i[[Z]] 23 to i8*), i8** [[P0]]
1971 //
1972 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
1973 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
1974 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
1975 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
1976 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
1977 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
1978 //
1979 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
1980 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
1981 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
1982 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
1983 // CK19-DAG: [[CBPVAL2]] = inttoptr i[[Z]] [[VAR2:%.+]] to i8*
1984 // CK19-DAG: [[CPVAL2]] = inttoptr i[[Z]] [[VAR22:%.+]] to i8*
1985 //
1986 // CK19-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
1987 // CK19-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
1988 // CK19-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
1989 // CK19-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
1990 // CK19-DAG: [[CBPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
1991 // CK19-DAG: [[CPVAL3]] = bitcast double* [[SEC3:%.+]] to i8*
1992 // CK19-DAG: [[SEC3]] = getelementptr {{.*}}double* [[SEC33:%.+]], i[[Z]] 0
1993 // CK19-DAG: [[SEC33]] = getelementptr {{.*}}double* [[SEC333:%.+]], i[[Z]] [[IDX3:%.+]]
1994 // CK19-DAG: [[IDX3]] = mul nsw i[[Z]] %{{[^,]+}}, %{{[^,]+}}
1995 // CK19-DAG: [[SEC333]] = getelementptr {{.*}}double* [[VAR3]], i[[Z]] [[IDX33:%.+]]
1996 // CK19-DAG: [[IDX33]] = mul nsw i[[Z]] 1, %{{[^,]+}}
1997
1998 // CK19: call void [[CALL31:@.+]](i[[Z]] 23, i[[Z]] %{{[^,]+}}, i[[Z]] %{{[^,]+}}, double* %{{[^,]+}})
1999 #pragma omp target map(tofrom: mva[1][ii-2][:5])
2000 {
2001 mva[1][2][3]++;
2002 }
2003
2004 // Multidimensional array sections.
2005 double marras[11][12][13];
2006 double mvlaas[11][ii][13];
2007 double ***mptras;
2008
2009 // Region 32
2010 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE32]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE32]]{{.+}})
2011 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2012 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2013
2014 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2015 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2016 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2017 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2018 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2019 // CK19-DAG: [[CPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0]] to i8*
2020
2021 // CK19: call void [[CALL32:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2022 #pragma omp target map(marras)
2023 {
2024 marras[1][2][3]++;
2025 }
2026
2027 // Region 33
2028 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE33]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE33]]{{.+}})
2029 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2030 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2031
2032 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2033 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2034 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2035 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2036 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2037 // CK19-DAG: [[CPVAL0]] = bitcast [12 x [13 x double]]* [[SEC0:%.+]] to i8*
2038 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2039
2040 // CK19: call void [[CALL33:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2041 #pragma omp target map(marras[:])
2042 {
2043 marras[1][2][3]++;
2044 }
2045
2046 // Region 34
2047 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE34]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE34]]{{.+}})
2048 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2049 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2050
2051 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2052 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2053 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2054 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2055 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2056 // CK19-DAG: [[CPVAL0]] = bitcast [12 x [13 x double]]* [[SEC0:%.+]] to i8*
2057 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 0
2058
2059 // CK19: call void [[CALL34:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2060 #pragma omp target map(marras[:][:][:])
2061 {
2062 marras[1][2][3]++;
2063 }
2064
2065 // Region 35
2066 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE35]]{{.+}})
2067 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2068 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2069 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2070 //
2071 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2072 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2073 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2074
2075 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2076 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2077 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
2078 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2079 // CK19-DAG: [[CPVAL0]] = bitcast [13 x double]* [[SEC0:%.+]] to i8*
2080 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2081 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2082 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2083
2084 // CK19: call void [[CALL35:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2085 #pragma omp target map(marras[1][:ii][:])
2086 {
2087 marras[1][2][3]++;
2088 }
2089
2090 // Region 36
2091 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE36]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE36]]{{.+}})
2092 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2093 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2094
2095 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2096 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2097 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2098 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2099 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2100 // CK19-DAG: [[CPVAL0]] = bitcast [13 x double]* [[SEC0:%.+]] to i8*
2101 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[13 x double]* [[SEC00:%[^,]+]], i{{.+}} 0
2102 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 0
2103 // CK19-DAG: [[SEC000]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2104
2105 // CK19: call void [[CALL36:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2106 #pragma omp target map(marras[:1][:2][:13])
2107 {
2108 marras[1][2][3]++;
2109 }
2110
2111 // Region 37
2112 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE37]]{{.+}})
2113 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2114 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2115 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2116 //
2117 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2118 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2119 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2120 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2121 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2122 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2123 //
2124 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2125 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2126 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2127 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2128 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2129 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2130 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2131 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2132 //
2133 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2134 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2135 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2136 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2137 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2138 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2139 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2140 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[VAR2]] to i8*
2141 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2142
2143 // CK19: call void [[CALL37:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2144 #pragma omp target map(mvlaas)
2145 {
2146 mvlaas[1][2][3]++;
2147 }
2148
2149 // Region 38
2150 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE38]]{{.+}})
2151 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2152 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2153 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2154 //
2155 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2156 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2157 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2158 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2159 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2160 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2161 //
2162 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2163 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2164 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2165 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2166 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2167 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2168 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2169 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2170 //
2171 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2172 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2173 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2174 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2175 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2176 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2177 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2178 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2179 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2180 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2181 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2182
2183 // CK19: call void [[CALL38:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2184 #pragma omp target map(mvlaas[:])
2185 {
2186 mvlaas[1][2][3]++;
2187 }
2188
2189 // Region 39
2190 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE39]]{{.+}})
2191 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2192 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2193 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2194 //
2195 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2196 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2197 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2198 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2199 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2200 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2201 //
2202 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2203 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2204 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2205 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2206 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2207 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2208 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2209 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2210 //
2211 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2212 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2213 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2214 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2215 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2216 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2217 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2218 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2219 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC22:%[^,]+]]
2220 // CK19-DAG: [[SEC22]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2221 // CK19-DAG: [[CSVAL2]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2222
2223 // CK19: call void [[CALL39:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2224 #pragma omp target map(mvlaas[:][:][:])
2225 {
2226 mvlaas[1][2][3]++;
2227 }
2228
2229 // Region 40
2230 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE40]]{{.+}})
2231 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2232 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2233 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2234 //
2235 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2236 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2237 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2238 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2239 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2240 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S0]]
2241 //
2242 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2243 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2244 // CK19-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 1
2245 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2246 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2247 // CK19-DAG: store i[[Z]] {{8|4}}, i[[Z]]* [[S1]]
2248 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2249 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2250 //
2251 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2252 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2253 // CK19-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 2
2254 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2255 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2256 // CK19-DAG: store i[[Z]] [[CSVAL2:%[^,]+]], i[[Z]]* [[S2]]
2257 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2258 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2259 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2260 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2261 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 1, %{{[^,]+}}
2262
2263 // CK19: call void [[CALL40:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2264 #pragma omp target map(mvlaas[1][:ii][:])
2265 {
2266 mvlaas[1][2][3]++;
2267 }
2268
2269 // Region 41
2270 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE41]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE41]]{{.+}})
2271 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2272 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2273 //
2274 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2275 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2276 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[BP0]]
2277 // CK19-DAG: store i8* inttoptr (i[[Z]] 11 to i8*), i8** [[P0]]
2278 //
2279 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2280 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2281 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2282 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2283 // CK19-DAG: [[CBPVAL1]] = inttoptr i[[Z]] [[VAR1:%.+]] to i8*
2284 // CK19-DAG: [[CPVAL1]] = inttoptr i[[Z]] [[VAR11:%.+]] to i8*
2285 //
2286 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2287 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2288 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2289 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2290 // CK19-DAG: [[CBPVAL2]] = bitcast [13 x double]* [[VAR2:%.+]] to i8*
2291 // CK19-DAG: [[CPVAL2]] = bitcast [13 x double]* [[SEC2:%.+]] to i8*
2292 // CK19-DAG: [[SEC2]] = getelementptr {{.+}}[13 x double]* [[SEC22:%[^,]+]], i[[Z]] 0
2293 // CK19-DAG: [[SEC22]] = getelementptr {{.+}}[13 x double]* [[VAR2]], i[[Z]] [[SEC222:%[^,]+]]
2294 // CK19-DAG: [[SEC222]] = mul nsw i[[Z]] 0, %{{[^,]+}}
2295
2296 // CK19: call void [[CALL41:@.+]](i[[Z]] 11, i[[Z]] %{{[^,]+}}, [13 x double]* %{{[^,]+}})
2297 #pragma omp target map(mvlaas[:1][:2][:13])
2298 {
2299 mvlaas[1][2][3]++;
2300 }
2301
2302 // Region 42
2303 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 3, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[SIZE42]], {{.+}}getelementptr {{.+}}[3 x i{{.+}}]* [[MTYPE42]]{{.+}})
2304 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2305 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2306
2307 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2308 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2309 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2310 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2311 // CK19-DAG: [[CBPVAL0]] = bitcast double*** [[VAR0:%.+]] to i8*
2312 // CK19-DAG: [[CPVAL0]] = bitcast double*** [[SEC0:%.+]] to i8*
2313 // CK19-DAG: [[VAR0]] = load double***, double**** [[PTR:%[^,]+]],
2314 // CK19-DAG: [[SEC0]] = getelementptr {{.*}}double*** [[SEC00:[^,]+]], i{{.+}} 0
2315 // CK19-DAG: [[SEC00]] = load double***, double**** [[PTR]],
2316
2317 // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2318 // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2319 // CK19-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2320 // CK19-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2321 // CK19-DAG: [[CBPVAL1]] = bitcast double*** [[SEC0]] to i8*
2322 // CK19-DAG: [[CPVAL1]] = bitcast double** [[SEC1:%.+]] to i8*
2323 // CK19-DAG: [[SEC1]] = getelementptr {{.*}}double** [[SEC11:[^,]+]], i{{.+}} 2
2324 // CK19-DAG: [[SEC11]] = load double**, double*** [[SEC111:%[^,]+]],
2325 // CK19-DAG: [[SEC111]] = getelementptr {{.*}}double*** [[SEC1111:[^,]+]], i{{.+}} 0
2326 // CK19-DAG: [[SEC1111]] = load double***, double**** [[PTR]],
2327
2328 // CK19-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
2329 // CK19-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
2330 // CK19-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
2331 // CK19-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
2332 // CK19-DAG: [[CBPVAL2]] = bitcast double** [[SEC1]] to i8*
2333 // CK19-DAG: [[CPVAL2]] = bitcast double* [[SEC2:%.+]] to i8*
2334 // CK19-DAG: [[SEC2]] = getelementptr {{.*}}double* [[SEC22:[^,]+]], i{{.+}} 0
2335 // CK19-DAG: [[SEC22]] = load double*, double** [[SEC222:%[^,]+]],
2336 // CK19-DAG: [[SEC222]] = getelementptr {{.*}}double** [[SEC2222:[^,]+]], i{{.+}} 2
2337 // CK19-DAG: [[SEC2222]] = load double**, double*** [[SEC22222:%[^,]+]],
2338 // CK19-DAG: [[SEC22222]] = getelementptr {{.*}}double*** [[SEC222222:[^,]+]], i{{.+}} 0
2339 // CK19-DAG: [[SEC222222]] = load double***, double**** [[PTR]],
2340
2341 // CK19: call void [[CALL42:@.+]](double*** {{[^,]+}})
2342 #pragma omp target map(mptras[:1][2][:13])
2343 {
2344 mptras[1][2][3]++;
2345 }
2346
2347 // Region 43 - the memory is not contiguous for this map - will map the whole last dimension.
2348 // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[Z]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE43]]{{.+}})
2349 // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2350 // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2351 // CK19-DAG: [[GEPS]] = getelementptr inbounds {{.+}}[[S:%[^,]+]]
2352 //
2353 // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2354 // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2355 // CK19-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[S]], i{{.+}} 0, i{{.+}} 0
2356
2357 // CK19-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2358 // CK19-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2359 // CK19-DAG: store i[[Z]] [[CSVAL0:%[^,]+]], i[[Z]]* [[S0]]
2360 // CK19-DAG: [[CBPVAL0]] = bitcast [11 x [12 x [13 x double]]]* [[VAR0:%.+]] to i8*
2361 // CK19-DAG: [[CPVAL0]] = bitcast [13 x double]* [[SEC0:%.+]] to i8*
2362 // CK19-DAG: [[SEC0]] = getelementptr {{.+}}[12 x [13 x double]]* [[SEC00:%[^,]+]], i[[Z]] 0, i[[Z]] 0
2363 // CK19-DAG: [[SEC00]] = getelementptr {{.+}}[11 x [12 x [13 x double]]]* [[VAR0]], i[[Z]] 0, i[[Z]] 1
2364 // CK19-DAG: [[CSVAL0]] = mul nuw i[[Z]] %{{[^,]+}}, 104
2365
2366 // CK19: call void [[CALL43:@.+]]([11 x [12 x [13 x double]]]* {{[^,]+}})
2367 #pragma omp target map(marras[1][:ii][1:])
2368 {
2369 marras[1][2][3]++;
2370 }
2371
2372}
2373
2374// CK19: define {{.+}}[[CALL00]]
2375// CK19: define {{.+}}[[CALL01]]
2376// CK19: define {{.+}}[[CALL02]]
2377// CK19: define {{.+}}[[CALL03]]
2378// CK19: define {{.+}}[[CALL04]]
2379// CK19: define {{.+}}[[CALL05]]
2380// CK19: define {{.+}}[[CALL06]]
2381// CK19: define {{.+}}[[CALL07]]
2382// CK19: define {{.+}}[[CALL08]]
2383// CK19: define {{.+}}[[CALL09]]
2384// CK19: define {{.+}}[[CALL10]]
2385// CK19: define {{.+}}[[CALL11]]
2386// CK19: define {{.+}}[[CALL12]]
2387// CK19: define {{.+}}[[CALL13]]
2388// CK19: define {{.+}}[[CALL14]]
2389// CK19: define {{.+}}[[CALL15]]
2390// CK19: define {{.+}}[[CALL16]]
2391// CK19: define {{.+}}[[CALL17]]
2392// CK19: define {{.+}}[[CALL18]]
2393// CK19: define {{.+}}[[CALL19]]
2394// CK19: define {{.+}}[[CALL20]]
2395// CK19: define {{.+}}[[CALL21]]
2396// CK19: define {{.+}}[[CALL22]]
2397// CK19: define {{.+}}[[CALL23]]
2398// CK19: define {{.+}}[[CALL24]]
2399// CK19: define {{.+}}[[CALL25]]
2400// CK19: define {{.+}}[[CALL26]]
2401// CK19: define {{.+}}[[CALL27]]
2402// CK19: define {{.+}}[[CALL28]]
2403// CK19: define {{.+}}[[CALL29]]
2404// CK19: define {{.+}}[[CALL30]]
2405// CK19: define {{.+}}[[CALL31]]
2406// CK19: define {{.+}}[[CALL32]]
2407// CK19: define {{.+}}[[CALL33]]
2408// CK19: define {{.+}}[[CALL34]]
2409// CK19: define {{.+}}[[CALL35]]
2410// CK19: define {{.+}}[[CALL36]]
2411// CK19: define {{.+}}[[CALL37]]
2412// CK19: define {{.+}}[[CALL38]]
2413// CK19: define {{.+}}[[CALL39]]
2414// CK19: define {{.+}}[[CALL40]]
2415// CK19: define {{.+}}[[CALL41]]
2416// CK19: define {{.+}}[[CALL42]]
2417// CK19: define {{.+}}[[CALL43]]
2418
2419#endif
2420///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002421// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-64
2422// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2423// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-64
2424// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-32
2425// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2426// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK20 --check-prefix CK20-32
Samuel Antao86ace552016-04-27 22:40:57 +00002427#ifdef CK20
2428
2429// CK20: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002430// CK20: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002431
2432// CK20: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002433// CK20: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00002434
2435// CK20: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002436// CK20: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002437
2438// CK20: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 12]
Samuel Antao6782e942016-05-26 16:48:10 +00002439// CK20: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002440
2441// CK20-LABEL: explicit_maps_references_and_function_args
2442void explicit_maps_references_and_function_args (int a, float b, int (&c)[10], float *d){
2443
2444 int &aa = a;
2445 float &bb = b;
2446 int (&cc)[10] = c;
2447 float *&dd = d;
2448
2449 // Region 00
2450 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2451 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2452 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2453
2454 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2455 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2456 // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2457 // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2458 // CK20-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
2459 // CK20-DAG: [[CPVAL0]] = bitcast i32* [[RVAR00:%.+]] to i8*
2460 // CK20-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2461 // CK20-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2462
2463 // CK20: call void [[CALL00:@.+]](i32* {{[^,]+}})
2464 #pragma omp target map(to:aa)
2465 {
2466 aa += 1;
2467 }
2468
2469 // Region 01
2470 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2471 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2472 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2473
2474 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2475 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2476 // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2477 // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2478 // CK20-DAG: [[CBPVAL0]] = bitcast [10 x i32]* [[RVAR0:%.+]] to i8*
2479 // CK20-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2480 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[RVAR00:%.+]], i{{.+}} 0, i{{.+}} 0
2481 // CK20-DAG: [[RVAR0]] = load [10 x i32]*, [10 x i32]** [[VAR0:%[^,]+]]
2482 // CK20-DAG: [[RVAR00]] = load [10 x i32]*, [10 x i32]** [[VAR0]]
2483
2484 // CK20: call void [[CALL01:@.+]]([10 x i32]* {{[^,]+}})
2485 #pragma omp target map(to:cc[:5])
2486 {
2487 cc[3] += 1;
2488 }
2489
2490 // Region 02
2491 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2492 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2493 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2494
2495 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2496 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2497 // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2498 // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2499 // CK20-DAG: [[CBPVAL0]] = bitcast float* [[VAR0:%.+]] to i8*
2500 // CK20-DAG: [[CPVAL0]] = bitcast float* [[VAR0]] to i8*
2501
2502 // CK20: call void [[CALL02:@.+]](float* {{[^,]+}})
2503 #pragma omp target map(from:b)
2504 {
2505 b += 1.0f;
2506 }
2507
2508 // Region 03
2509 // CK20-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2510 // CK20-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2511 // CK20-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2512
2513 // CK20-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2514 // CK20-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2515 // CK20-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2516 // CK20-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2517 // CK20-DAG: [[CBPVAL0]] = bitcast float* [[RVAR0:%.+]] to i8*
2518 // CK20-DAG: [[CPVAL0]] = bitcast float* [[SEC0:%.+]] to i8*
2519 // CK20-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
2520 // CK20-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
2521 // CK20-DAG: [[RVAR00]] = load float*, float** [[VAR0]]
2522
2523 // CK20: call void [[CALL03:@.+]](float* {{[^,]+}})
2524 #pragma omp target map(from:d[2:3])
2525 {
2526 d[2] += 1.0f;
2527 }
2528}
2529
2530// CK20: define {{.+}}[[CALL00]]
2531// CK20: define {{.+}}[[CALL01]]
2532// CK20: define {{.+}}[[CALL02]]
2533// CK20: define {{.+}}[[CALL03]]
2534
2535#endif
2536///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002537// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-64
2538// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2539// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-64
2540// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-32
2541// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2542// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK21 --check-prefix CK21-32
Samuel Antao86ace552016-04-27 22:40:57 +00002543#ifdef CK21
2544// CK21: [[ST:%.+]] = type { i32, i32, float* }
2545
2546// CK21: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002547// CK21: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002548
2549// CK21: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
Samuel Antao6782e942016-05-26 16:48:10 +00002550// CK21: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002551
2552// CK21: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 500]
Samuel Antao6782e942016-05-26 16:48:10 +00002553// CK21: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 34, i32 18]
Samuel Antao86ace552016-04-27 22:40:57 +00002554
2555// CK21: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 492]
Samuel Antao6782e942016-05-26 16:48:10 +00002556// CK21: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002557
2558// CK21: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002559// CK21: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 34]
Samuel Antao86ace552016-04-27 22:40:57 +00002560
2561// CK21: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] 4, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002562// CK21: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 3]
Samuel Antao86ace552016-04-27 22:40:57 +00002563
2564// CK21-LABEL: explicit_maps_template_args_and_members
2565
2566template <int X, typename T>
2567struct CC {
2568 T A;
2569 int A2;
2570 float *B;
2571
2572 int foo(T arg) {
2573 float la[X];
2574 T *lb;
2575
2576 // Region 00
2577 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2578 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2579 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2580
2581 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2582 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2583 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2584 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2585 // CK21-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
2586 // CK21-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2587 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
2588
2589 // CK21: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
2590 #pragma omp target map(A)
2591 {
2592 A += 1;
2593 }
2594
2595 // Region 01
2596 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2597 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2598 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2599
2600 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2601 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2602 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2603 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2604 // CK21-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
2605 // CK21-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2606 // CK21-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
2607 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
2608 // CK21-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
2609
2610 // CK21: call void [[CALL01:@.+]](i32* {{[^,]+}})
2611 #pragma omp target map(lb[:X])
2612 {
2613 lb[4] += 1;
2614 }
2615
2616 // Region 02
2617 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
2618 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2619 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2620
2621 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2622 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2623 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2624 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2625 // CK21-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
2626 // CK21-DAG: [[CPVAL0]] = bitcast float** [[SEC0:%.+]] to i8*
2627 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2628
2629 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2630 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2631 // CK21-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2632 // CK21-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2633 // CK21-DAG: [[CBPVAL1]] = bitcast float** [[SEC0]] to i8*
2634 // CK21-DAG: [[CPVAL1]] = bitcast float* [[SEC1:%.+]] to i8*
2635 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}float* [[RVAR1:%[^,]+]], i{{.+}} 123
2636 // CK21-DAG: [[RVAR1]] = load float*, float** [[SEC1_:%[^,]+]]
2637 // CK21-DAG: [[SEC1_]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
2638
2639 // CK21: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}})
2640 #pragma omp target map(from:B[X:X+2])
2641 {
2642 B[2] += 1.0f;
2643 }
2644
2645 // Region 03
2646 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2647 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2648 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2649
2650 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2651 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2652 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2653 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2654 // CK21-DAG: [[CBPVAL0]] = bitcast [123 x float]* [[VAR0:%.+]] to i8*
2655 // CK21-DAG: [[CPVAL0]] = bitcast [123 x float]* [[VAR0]] to i8*
2656
2657 // CK21: call void [[CALL03:@.+]]([123 x float]* {{[^,]+}})
2658 #pragma omp target map(from:la)
2659 {
2660 la[3] += 1.0f;
2661 }
2662
2663 // Region 04
2664 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2665 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2666 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2667
2668 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2669 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2670 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2671 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2672 // CK21-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
2673 // CK21-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
2674
2675 // CK21: call void [[CALL04:@.+]](i32* {{[^,]+}})
2676 #pragma omp target map(from:arg)
2677 {
2678 arg +=1;
2679 }
2680
2681 // Make sure the extra flag is passed to the second map.
2682 // Region 05
2683 // CK21-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
2684 // CK21-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2685 // CK21-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2686
2687 // CK21-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2688 // CK21-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2689 // CK21-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2690 // CK21-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2691 // CK21-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
2692 // CK21-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2693 // CK21-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
2694
2695 // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
2696 // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
2697 // CK21-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
2698 // CK21-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
2699 // CK21-DAG: [[CBPVAL1]] = bitcast [[ST]]* [[VAR1:%.+]] to i8*
2700 // CK21-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
2701 // CK21-DAG: [[SEC1]] = getelementptr {{.*}}[[ST]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
2702
2703 // CK21: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2704 #pragma omp target map(A, A2)
2705 {
2706 A += 1;
2707 A2 += 1;
2708 }
2709 return A;
2710 }
2711};
2712
2713int explicit_maps_template_args_and_members(int a){
2714 CC<123,int> c;
2715 return c.foo(a);
2716}
2717
2718// CK21: define {{.+}}[[CALL00]]
2719// CK21: define {{.+}}[[CALL01]]
2720// CK21: define {{.+}}[[CALL02]]
2721// CK21: define {{.+}}[[CALL03]]
2722// CK21: define {{.+}}[[CALL04]]
2723// CK21: define {{.+}}[[CALL05]]
2724#endif
2725///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00002726// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-64
2727// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
2728// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-64
2729// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-32
2730// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
2731// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK22 --check-prefix CK22-32
Samuel Antao86ace552016-04-27 22:40:57 +00002732#ifdef CK22
2733
2734// CK22-DAG: [[ST:%.+]] = type { float }
2735// CK22-DAG: [[STT:%.+]] = type { i32 }
2736
2737// CK22: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002738// CK22: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002739
2740// CK22: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002741// CK22: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002742
2743// CK22: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002744// CK22: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002745
2746// CK22: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002747// CK22: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002748
2749// CK22: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002750// CK22: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002751
2752// CK22: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002753// CK22: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002754
2755// CK22: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002756// CK22: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002757
2758// CK22: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002759// CK22: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002760
2761// CK22: [[SIZE08:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002762// CK22: [[MTYPE08:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002763
2764// CK22: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002765// CK22: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002766
2767// CK22: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00002768// CK22: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002769
2770// CK22: [[SIZE11:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00002771// CK22: [[MTYPE11:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002772
2773// CK22: [[SIZE12:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00002774// CK22: [[MTYPE12:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002775
2776// CK22: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00002777// CK22: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002778
2779// CK22: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00002780// CK22: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00002781
2782int a;
2783int c[100];
2784int *d;
2785
2786struct ST {
2787 float fa;
2788};
2789
2790ST sa ;
2791ST sc[100];
2792ST *sd;
2793
2794template<typename T>
2795struct STT {
2796 T fa;
2797};
2798
2799STT<int> sta ;
2800STT<int> stc[100];
2801STT<int> *std;
2802
2803// CK22-LABEL: explicit_maps_globals
2804int explicit_maps_globals(void){
2805 // Region 00
2806 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
2807 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2808 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2809
2810 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2811 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2812 // CK22-DAG: store i8* bitcast (i32* @a to i8*), i8** [[BP0]]
2813 // CK22-DAG: store i8* bitcast (i32* @a to i8*), i8** [[P0]]
2814
2815 // CK22: call void [[CALL00:@.+]](i32* {{[^,]+}})
2816 #pragma omp target map(a)
2817 { a+=1; }
2818
2819 // Region 01
2820 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
2821 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2822 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2823
2824 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2825 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2826 // CK22-DAG: store i8* bitcast ([100 x i32]* @c to i8*), i8** [[BP0]]
2827 // CK22-DAG: store i8* bitcast ([100 x i32]* @c to i8*), i8** [[P0]]
2828
2829 // CK22: call void [[CALL01:@.+]]([100 x i32]* {{[^,]+}})
2830 #pragma omp target map(c)
2831 { c[3]+=1; }
2832
2833 // Region 02
2834 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
2835 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2836 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2837
2838 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2839 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2840 // CK22-DAG: store i8* bitcast (i32** @d to i8*), i8** [[BP0]]
2841 // CK22-DAG: store i8* bitcast (i32** @d to i8*), i8** [[P0]]
2842
2843 // CK22: call void [[CALL02:@.+]](i32** {{[^,]+}})
2844 #pragma omp target map(d)
2845 { d[3]+=1; }
2846
2847 // Region 03
2848 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
2849 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2850 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2851
2852 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2853 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2854 // CK22-DAG: store i8* bitcast ([100 x i32]* @c to i8*), i8** [[BP0]]
2855 // CK22-DAG: store i8* bitcast (i32* getelementptr inbounds ([100 x i32], [100 x i32]* @c, i{{.+}} 0, i{{.+}} 1) to i8*), i8** [[P0]]
2856
2857 // CK22: call void [[CALL03:@.+]]([100 x i32]* {{[^,]+}})
2858 #pragma omp target map(c[1:4])
2859 { c[3]+=1; }
2860
2861 // Region 04
2862 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
2863 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2864 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2865
2866 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2867 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2868 // CK22-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2869 // CK22-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2870 // CK22-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
2871 // CK22-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
2872 // CK22-DAG: [[RVAR0]] = load i32*, i32** @d
2873 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 2
2874 // CK22-DAG: [[RVAR00]] = load i32*, i32** @d
2875
2876 // CK22: call void [[CALL04:@.+]](i32* {{[^,]+}})
2877 #pragma omp target map(d[2:5])
2878 { d[3]+=1; }
2879
2880 // Region 05
2881 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
2882 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2883 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2884
2885 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2886 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2887 // CK22-DAG: store i8* bitcast ([[ST]]* @sa to i8*), i8** [[BP0]]
2888 // CK22-DAG: store i8* bitcast ([[ST]]* @sa to i8*), i8** [[P0]]
2889
2890 // CK22: call void [[CALL05:@.+]]([[ST]]* {{[^,]+}})
2891 #pragma omp target map(sa)
2892 { sa.fa+=1; }
2893
2894 // Region 06
2895 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
2896 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2897 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2898
2899 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2900 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2901 // CK22-DAG: store i8* bitcast ([100 x [[ST]]]* @sc to i8*), i8** [[BP0]]
2902 // CK22-DAG: store i8* bitcast ([100 x [[ST]]]* @sc to i8*), i8** [[P0]]
2903
2904 // CK22: call void [[CALL06:@.+]]([100 x [[ST]]]* {{[^,]+}})
2905 #pragma omp target map(sc)
2906 { sc[3].fa+=1; }
2907
2908 // Region 07
2909 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE07]]{{.+}})
2910 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2911 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2912
2913 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2914 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2915 // CK22-DAG: store i8* bitcast ([[ST]]** @sd to i8*), i8** [[BP0]]
2916 // CK22-DAG: store i8* bitcast ([[ST]]** @sd to i8*), i8** [[P0]]
2917
2918 // CK22: call void [[CALL07:@.+]]([[ST]]** {{[^,]+}})
2919 #pragma omp target map(sd)
2920 { sd[3].fa+=1; }
2921
2922 // Region 08
2923 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE08]]{{.+}})
2924 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2925 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2926
2927 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2928 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2929 // CK22-DAG: store i8* bitcast ([100 x [[ST]]]* @sc to i8*), i8** [[BP0]]
2930 // CK22-DAG: store i8* bitcast ([[ST]]* getelementptr inbounds ([100 x [[ST]]], [100 x [[ST]]]* @sc, i{{.+}} 0, i{{.+}} 1) to i8*), i8** [[P0]]
2931
2932 // CK22: call void [[CALL08:@.+]]([100 x [[ST]]]* {{[^,]+}})
2933 #pragma omp target map(sc[1:4])
2934 { sc[3].fa+=1; }
2935
2936 // Region 09
2937 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
2938 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2939 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2940
2941 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2942 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2943 // CK22-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
2944 // CK22-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
2945 // CK22-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[RVAR0:%.+]] to i8*
2946 // CK22-DAG: [[CPVAL0]] = bitcast [[ST]]* [[SEC0:%.+]] to i8*
2947 // CK22-DAG: [[RVAR0]] = load [[ST]]*, [[ST]]** @sd
2948 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[RVAR00:%.+]], i{{.+}} 2
2949 // CK22-DAG: [[RVAR00]] = load [[ST]]*, [[ST]]** @sd
2950
2951 // CK22: call void [[CALL09:@.+]]([[ST]]* {{[^,]+}})
2952 #pragma omp target map(sd[2:5])
2953 { sd[3].fa+=1; }
2954
2955 // Region 10
2956 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
2957 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2958 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2959
2960 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2961 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2962 // CK22-DAG: store i8* bitcast ([[STT]]* @sta to i8*), i8** [[BP0]]
2963 // CK22-DAG: store i8* bitcast ([[STT]]* @sta to i8*), i8** [[P0]]
2964
2965 // CK22: call void [[CALL10:@.+]]([[STT]]* {{[^,]+}})
2966 #pragma omp target map(sta)
2967 { sta.fa+=1; }
2968
2969 // Region 11
2970 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE11]]{{.+}})
2971 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2972 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2973
2974 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2975 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2976 // CK22-DAG: store i8* bitcast ([100 x [[STT]]]* @stc to i8*), i8** [[BP0]]
2977 // CK22-DAG: store i8* bitcast ([100 x [[STT]]]* @stc to i8*), i8** [[P0]]
2978
2979 // CK22: call void [[CALL11:@.+]]([100 x [[STT]]]* {{[^,]+}})
2980 #pragma omp target map(stc)
2981 { stc[3].fa+=1; }
2982
2983 // Region 12
2984 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE12]]{{.+}})
2985 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
2986 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
2987
2988 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
2989 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
2990 // CK22-DAG: store i8* bitcast ([[STT]]** @std to i8*), i8** [[BP0]]
2991 // CK22-DAG: store i8* bitcast ([[STT]]** @std to i8*), i8** [[P0]]
2992
2993 // CK22: call void [[CALL12:@.+]]([[STT]]** {{[^,]+}})
2994 #pragma omp target map(std)
2995 { std[3].fa+=1; }
2996
2997 // Region 13
2998 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
2999 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3000 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3001
3002 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3003 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3004 // CK22-DAG: store i8* bitcast ([100 x [[STT]]]* @stc to i8*), i8** [[BP0]]
3005 // CK22-DAG: store i8* bitcast ([[STT]]* getelementptr inbounds ([100 x [[STT]]], [100 x [[STT]]]* @stc, i{{.+}} 0, i{{.+}} 1) to i8*), i8** [[P0]]
3006
3007 // CK22: call void [[CALL13:@.+]]([100 x [[STT]]]* {{[^,]+}})
3008 #pragma omp target map(stc[1:4])
3009 { stc[3].fa+=1; }
3010
3011 // Region 14
3012 // CK22-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
3013 // CK22-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3014 // CK22-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3015
3016 // CK22-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3017 // CK22-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3018 // CK22-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3019 // CK22-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3020 // CK22-DAG: [[CBPVAL0]] = bitcast [[STT]]* [[RVAR0:%.+]] to i8*
3021 // CK22-DAG: [[CPVAL0]] = bitcast [[STT]]* [[SEC0:%.+]] to i8*
3022 // CK22-DAG: [[RVAR0]] = load [[STT]]*, [[STT]]** @std
3023 // CK22-DAG: [[SEC0]] = getelementptr {{.*}}[[STT]]* [[RVAR00:%.+]], i{{.+}} 2
3024 // CK22-DAG: [[RVAR00]] = load [[STT]]*, [[STT]]** @std
3025
3026 // CK22: call void [[CALL14:@.+]]([[STT]]* {{[^,]+}})
3027 #pragma omp target map(std[2:5])
3028 { std[3].fa+=1; }
3029
3030 return 0;
3031}
3032// CK22: define {{.+}}[[CALL00]]
3033// CK22: define {{.+}}[[CALL01]]
3034// CK22: define {{.+}}[[CALL02]]
3035// CK22: define {{.+}}[[CALL03]]
3036// CK22: define {{.+}}[[CALL04]]
3037// CK22: define {{.+}}[[CALL05]]
3038// CK22: define {{.+}}[[CALL06]]
3039// CK22: define {{.+}}[[CALL07]]
3040// CK22: define {{.+}}[[CALL08]]
3041// CK22: define {{.+}}[[CALL09]]
3042// CK22: define {{.+}}[[CALL10]]
3043// CK22: define {{.+}}[[CALL11]]
3044// CK22: define {{.+}}[[CALL12]]
3045// CK22: define {{.+}}[[CALL13]]
3046// CK22: define {{.+}}[[CALL14]]
3047#endif
3048///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003049// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-64
3050// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3051// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-64
3052// RUN: %clang_cc1 -std=c++11 -DCK23 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-32
3053// RUN: %clang_cc1 -std=c++11 -DCK23 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3054// RUN: %clang_cc1 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-32
Samuel Antao86ace552016-04-27 22:40:57 +00003055#ifdef CK23
3056
3057// CK23: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003058// CK23: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003059
3060// CK23: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003061// CK23: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003062
3063// CK23: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
Samuel Antao6782e942016-05-26 16:48:10 +00003064// CK23: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003065
3066// CK23: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003067// CK23: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003068
3069// CK23: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00003070// CK23: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003071
3072// CK23: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 16]
Samuel Antao6782e942016-05-26 16:48:10 +00003073// CK23: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003074
3075// CK23-LABEL: explicit_maps_inside_captured
3076int explicit_maps_inside_captured(int a){
3077 float b;
3078 float c[100];
3079 float *d;
3080
3081 // CK23: call void @{{.*}}explicit_maps_inside_captured{{.*}}([[SA:%.+]]* {{.*}})
3082 // CK23: define {{.*}}explicit_maps_inside_captured{{.*}}
3083 [&](void){
3084 // Region 00
3085 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
3086 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3087 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3088
3089 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3090 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3091 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3092 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3093 // CK23-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
3094 // CK23-DAG: [[CPVAL0]] = bitcast i32* [[VAR00:%.+]] to i8*
3095 // CK23-DAG: [[VAR0]] = load i32*, i32** [[CAP0:%[^,]+]]
3096 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3097 // CK23-DAG: [[VAR00]] = load i32*, i32** [[CAP00:%[^,]+]]
3098 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3099
3100 // CK23: call void [[CALL00:@.+]](i32* {{[^,]+}})
3101 #pragma omp target map(a)
3102 { a+=1; }
3103 // Region 01
3104 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3105 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3106 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3107
3108 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3109 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3110 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3111 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3112 // CK23-DAG: [[CBPVAL0]] = bitcast float* [[VAR0:%.+]] to i8*
3113 // CK23-DAG: [[CPVAL0]] = bitcast float* [[VAR00:%.+]] to i8*
3114 // CK23-DAG: [[VAR0]] = load float*, float** [[CAP0:%[^,]+]]
3115 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3116 // CK23-DAG: [[VAR00]] = load float*, float** [[CAP00:%[^,]+]]
3117 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3118
3119 // CK23: call void [[CALL01:@.+]](float* {{[^,]+}})
3120 #pragma omp target map(b)
3121 { b+=1; }
3122 // Region 02
3123 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
3124 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3125 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3126
3127 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3128 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3129 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3130 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3131 // CK23-DAG: [[CBPVAL0]] = bitcast [100 x float]* [[VAR0:%.+]] to i8*
3132 // CK23-DAG: [[CPVAL0]] = bitcast [100 x float]* [[VAR00:%.+]] to i8*
3133 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3134 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3135 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3136 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3137
3138 // CK23: call void [[CALL02:@.+]]([100 x float]* {{[^,]+}})
3139 #pragma omp target map(c)
3140 { c[3]+=1; }
3141
3142 // Region 03
3143 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
3144 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3145 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3146
3147 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3148 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3149 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3150 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3151 // CK23-DAG: [[CBPVAL0]] = bitcast float** [[VAR0:%.+]] to i8*
3152 // CK23-DAG: [[CPVAL0]] = bitcast float** [[VAR00:%.+]] to i8*
3153 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3154 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3155 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3156 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3157
3158 // CK23: call void [[CALL03:@.+]](float** {{[^,]+}})
3159 #pragma omp target map(d)
3160 { d[3]+=1; }
3161 // Region 04
3162 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
3163 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3164 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3165
3166 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3167 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3168 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3169 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3170 // CK23-DAG: [[CBPVAL0]] = bitcast [100 x float]* [[VAR0:%.+]] to i8*
3171 // CK23-DAG: [[CPVAL0]] = bitcast float* [[SEC0:%.+]] to i8*
3172 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}[100 x float]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3173 // CK23-DAG: [[VAR0]] = load [100 x float]*, [100 x float]** [[CAP0:%[^,]+]]
3174 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3175 // CK23-DAG: [[VAR00]] = load [100 x float]*, [100 x float]** [[CAP00:%[^,]+]]
3176 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3177
3178 // CK23: call void [[CALL04:@.+]]([100 x float]* {{[^,]+}})
3179 #pragma omp target map(c[2:4])
3180 { c[3]+=1; }
3181
3182 // Region 05
3183 // CK23-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
3184 // CK23-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3185 // CK23-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3186
3187 // CK23-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3188 // CK23-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3189 // CK23-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3190 // CK23-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3191 // CK23-DAG: [[CBPVAL0]] = bitcast float* [[RVAR0:%.+]] to i8*
3192 // CK23-DAG: [[CPVAL0]] = bitcast float* [[SEC0:%.+]] to i8*
3193 // CK23-DAG: [[RVAR0]] = load float*, float** [[VAR0:%[^,]+]]
3194 // CK23-DAG: [[SEC0]] = getelementptr {{.*}}float* [[RVAR00:%.+]], i{{.+}} 2
3195 // CK23-DAG: [[RVAR00]] = load float*, float** [[VAR00:%[^,]+]]
3196 // CK23-DAG: [[VAR0]] = load float**, float*** [[CAP0:%[^,]+]]
3197 // CK23-DAG: [[CAP0]] = getelementptr inbounds [[SA]], [[SA]]
3198 // CK23-DAG: [[VAR00]] = load float**, float*** [[CAP00:%[^,]+]]
3199 // CK23-DAG: [[CAP00]] = getelementptr inbounds [[SA]], [[SA]]
3200
3201 // CK23: call void [[CALL05:@.+]](float* {{[^,]+}})
3202 #pragma omp target map(d[2:4])
3203 { d[3]+=1; }
3204 }();
3205 return b;
3206}
3207
3208// CK23: define {{.+}}[[CALL00]]
3209// CK23: define {{.+}}[[CALL01]]
3210// CK23: define {{.+}}[[CALL02]]
3211// CK23: define {{.+}}[[CALL03]]
3212// CK23: define {{.+}}[[CALL04]]
3213// CK23: define {{.+}}[[CALL05]]
3214#endif
3215///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00003216// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-64
3217// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
3218// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-64
3219// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-32
3220// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
3221// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK24 --check-prefix CK24-32
Samuel Antao86ace552016-04-27 22:40:57 +00003222#ifdef CK24
3223
3224// CK24-DAG: [[SC:%.+]] = type { i32, [[SB:%.+]], [[SB:%.+]]*, [10 x i32] }
3225// CK24-DAG: [[SB]] = type { i32, [[SA:%.+]], [10 x [[SA:%.+]]], [10 x [[SA:%.+]]*], [[SA:%.+]]* }
3226// CK24-DAG: [[SA]] = type { i32, [[SA]]*, [10 x i32] }
3227
3228struct SA{
3229 int a;
3230 struct SA *p;
3231 int b[10];
3232};
3233struct SB{
3234 int a;
3235 struct SA s;
3236 struct SA sa[10];
3237 struct SA *sp[10];
3238 struct SA *p;
3239};
3240struct SC{
3241 int a;
3242 struct SB s;
3243 struct SB *p;
3244 int b[10];
3245};
3246
3247// CK24: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003248// CK24: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003249
3250// CK24: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003251// CK24: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003252
3253// CK24: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003254// CK24: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003255
3256// CK24: [[SIZE04:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00003257// CK24: [[MTYPE04:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003258
3259// CK24: [[SIZE05:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003260// CK24: [[MTYPE05:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003261
3262// CK24: [[SIZE06:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003263// CK24: [[MTYPE06:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003264
3265// CK24: [[SIZE07:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003266// CK24: [[MTYPE07:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003267
3268// CK24: [[SIZE08:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003269// CK24: [[MTYPE08:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003270
3271// CK24: [[SIZE09:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003272// CK24: [[MTYPE09:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003273
3274// CK24: [[SIZE10:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 8]
Samuel Antao6782e942016-05-26 16:48:10 +00003275// CK24: [[MTYPE10:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003276
3277// CK24: [[SIZE11:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003278// CK24: [[MTYPE11:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003279
3280// 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 +00003281// CK24: [[MTYPE12:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 19, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003282
3283// CK24: [[SIZE13:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003284// CK24: [[MTYPE13:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003285
3286// CK24: [[SIZE14:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{56|48}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003287// CK24: [[MTYPE14:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003288
3289// CK24: [[SIZE15:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003290// CK24: [[MTYPE15:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003291
3292// CK24: [[SIZE16:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 20]
Samuel Antao6782e942016-05-26 16:48:10 +00003293// CK24: [[MTYPE16:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003294
3295// CK24: [[SIZE17:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{3560|2880}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003296// CK24: [[MTYPE17:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003297
3298// CK24: [[SIZE18:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003299// CK24: [[MTYPE18:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003300
3301// CK24: [[SIZE19:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003302// CK24: [[MTYPE19:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003303
3304// CK24: [[SIZE20:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003305// CK24: [[MTYPE20:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003306
3307// CK24: [[SIZE21:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00003308// CK24: [[MTYPE21:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003309
3310// CK24: [[SIZE22:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003311// CK24: [[MTYPE22:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00003312
3313// CK24: [[SIZE23:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}]
Samuel Antao6782e942016-05-26 16:48:10 +00003314// CK24: [[MTYPE23:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003315
3316// 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 +00003317// CK24: [[MTYPE24:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 19, i32 19, i32 19]
Samuel Antao86ace552016-04-27 22:40:57 +00003318
3319// CK24-LABEL: explicit_maps_struct_fields
3320int explicit_maps_struct_fields(int a){
3321 SC s;
3322 SC *p;
3323
3324// Region 01
3325// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
3326// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3327// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3328
3329// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3330// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3331// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3332// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3333// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3334// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3335// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 0
3336
3337// CK24: call void [[CALL01:@.+]]([[SC]]* {{[^,]+}})
3338#pragma omp target map(s.a)
3339 { s.a++; }
3340
3341// Region 02
3342// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
3343// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3344// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3345
3346// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3347// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3348// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3349// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3350// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3351// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]* [[SEC0:%.+]] to i8*
3352// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3353// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3354
3355// CK24: call void [[CALL02:@.+]]([[SC]]* {{[^,]+}})
3356#pragma omp target map(s.s.s)
3357 { s.a++; }
3358
3359// Region 03
3360// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
3361// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3362// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3363
3364// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3365// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3366// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3367// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3368// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3369// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3370// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3371// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3372// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3373
3374// CK24: call void [[CALL03:@.+]]([[SC]]* {{[^,]+}})
3375#pragma omp target map(s.s.s.a)
3376 { s.a++; }
3377
3378// Region 04
3379// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE04]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE04]]{{.+}})
3380// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3381// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3382
3383// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3384// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3385// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3386// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3387// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3388// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3389// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3390// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 3
3391
3392// CK24: call void [[CALL04:@.+]]([[SC]]* {{[^,]+}})
3393#pragma omp target map(s.b[:5])
3394 { s.a++; }
3395
3396// Region 05
3397// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE05]]{{.+}})
3398// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3399// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3400
3401// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3402// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3403// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3404// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3405// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3406// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3407// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3408
3409// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3410// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3411// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3412// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3413// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3414// CK24-DAG: [[CPVAL1]] = bitcast [[SB]]* [[SEC1:%.+]] to i8*
3415// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3416// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3417// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3418
3419// CK24: call void [[CALL05:@.+]]([[SC]]* {{[^,]+}})
3420#pragma omp target map(s.p[:5])
3421 { s.a++; }
3422
3423// Region 06
3424// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE06]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE06]]{{.+}})
3425// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3426// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3427
3428// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3429// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3430// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3431// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3432// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3433// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3434// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3435// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3436// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3437// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3438
3439// CK24: call void [[CALL06:@.+]]([[SC]]* {{[^,]+}})
3440#pragma omp target map(s.s.sa[3].a)
3441 { s.a++; }
3442
3443// Region 07
3444// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE07]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE07]]{{.+}})
3445// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3446// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3447
3448// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3449// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3450// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3451// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3452// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3453// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3454// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3455// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3456// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3457
3458// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3459// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3460// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3461// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3462// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3463// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3464// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3465// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3466// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3467// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3468// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3469
3470// CK24: call void [[CALL07:@.+]]([[SC]]* {{[^,]+}})
3471#pragma omp target map(s.s.sp[3]->a)
3472 { s.a++; }
3473
3474// Region 08
3475// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE08]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE08]]{{.+}})
3476// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3477// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3478
3479// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3480// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3481// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3482// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3483// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3484// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3485// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3486
3487// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3488// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3489// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3490// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3491// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3492// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3493// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3494// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3495// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3496
3497// CK24: call void [[CALL08:@.+]]([[SC]]* {{[^,]+}})
3498#pragma omp target map(s.p->a)
3499 { s.a++; }
3500
3501// Region 09
3502// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE09]]{{.+}})
3503// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3504// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3505
3506// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3507// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3508// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3509// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3510// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3511// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3512// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3513// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3514
3515// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3516// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3517// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3518// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3519// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3520// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3521// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3522// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3523// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3524// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3525
3526// CK24: call void [[CALL09:@.+]]([[SC]]* {{[^,]+}})
3527#pragma omp target map(s.s.p->a)
3528 { s.a++; }
3529
3530// Region 10
3531// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE10]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE10]]{{.+}})
3532// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3533// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3534
3535// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3536// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3537// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3538// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3539// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3540// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3541// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3542// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3543// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3544// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3545
3546// CK24: call void [[CALL10:@.+]]([[SC]]* {{[^,]+}})
3547#pragma omp target map(s.s.s.b[:2])
3548 { s.a++; }
3549
3550// Region 11
3551// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE11]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE11]]{{.+}})
3552// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3553// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3554
3555// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3556// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3557// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3558// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3559// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3560// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3561// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3562// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3563
3564// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3565// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3566// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3567// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3568// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3569// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3570// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3571// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3572// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3573// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3574// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 1
3575
3576// CK24: call void [[CALL11:@.+]]([[SC]]* {{[^,]+}})
3577#pragma omp target map(s.s.p->b[:2])
3578 { s.a++; }
3579
3580// Region 12
3581// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE12]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE12]]{{.+}})
3582// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3583// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3584
3585// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3586// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3587// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3588// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3589// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3590// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3591// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3592
3593// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3594// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3595// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3596// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3597// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3598// CK24-DAG: [[CPVAL1]] = bitcast [[SA]]** [[SEC1:%.+]] to i8*
3599// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3600// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3601// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3602
3603// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3604// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
3605// CK24-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
3606// CK24-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
3607// CK24-DAG: [[CBPVAL2]] = bitcast [[SA]]** [[SEC1]] to i8*
3608// CK24-DAG: [[CPVAL2]] = bitcast [[SA]]** [[SEC2:%.+]] to i8*
3609// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3610// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
3611// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3612// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
3613// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3614
3615// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
3616// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
3617// CK24-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
3618// CK24-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
3619// CK24-DAG: [[CBPVAL3]] = bitcast [[SA]]** [[SEC2]] to i8*
3620// CK24-DAG: [[CPVAL3]] = bitcast i32* [[SEC3:%.+]] to i8*
3621// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3622// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
3623// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3624// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
3625// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3626// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
3627// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR0]], i{{.+}} 0, i{{.+}} 2
3628
3629// CK24: call void [[CALL12:@.+]]([[SC]]* {{[^,]+}})
3630#pragma omp target map(s.p->p->p->a)
3631 { s.a++; }
3632
3633//
3634// Same thing but starting from a pointer.
3635//
3636// Region 13
3637// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE13]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE13]]{{.+}})
3638// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3639// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3640
3641// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3642// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3643// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3644// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3645// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3646// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3647// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 0
3648
3649// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3650// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3651
3652// CK24: call void [[CALL13:@.+]]([[SC]]* {{[^,]+}})
3653#pragma omp target map(p->a)
3654 { p->a++; }
3655
3656// Region 14
3657// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE14]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE14]]{{.+}})
3658// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3659// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3660
3661// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3662// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3663// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3664// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3665// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3666// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]* [[SEC0:%.+]] to i8*
3667// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3668// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3669
3670// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3671// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3672
3673// CK24: call void [[CALL14:@.+]]([[SC]]* {{[^,]+}})
3674#pragma omp target map(p->s.s)
3675 { p->a++; }
3676
3677// Region 15
3678// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE15]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE15]]{{.+}})
3679// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3680// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3681
3682// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3683// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3684// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3685// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3686// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3687// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3688// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3689// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3690// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3691
3692// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3693// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3694
3695// CK24: call void [[CALL15:@.+]]([[SC]]* {{[^,]+}})
3696#pragma omp target map(p->s.s.a)
3697 { p->a++; }
3698
3699// Region 16
3700// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE16]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE16]]{{.+}})
3701// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3702// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3703
3704// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3705// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3706// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3707// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3708// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3709// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3710// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3711// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 3
3712
3713// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3714// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3715
3716// CK24: call void [[CALL16:@.+]]([[SC]]* {{[^,]+}})
3717#pragma omp target map(p->b[:5])
3718 { p->a++; }
3719
3720// Region 17
3721// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE17]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE17]]{{.+}})
3722// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3723// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3724
3725// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3726// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3727// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3728// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3729// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3730// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3731// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3732
3733// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3734// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3735// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3736// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3737// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3738// CK24-DAG: [[CPVAL1]] = bitcast [[SB]]* [[SEC1:%.+]] to i8*
3739// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3740// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3741// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3742
3743// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3744// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3745// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3746
3747// CK24: call void [[CALL17:@.+]]([[SC]]* {{[^,]+}})
3748#pragma omp target map(p->p[:5])
3749 { p->a++; }
3750
3751// Region 18
3752// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE18]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE18]]{{.+}})
3753// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3754// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3755
3756// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3757// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3758// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3759// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3760// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3761// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3762// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SA]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3763// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[10 x [[SA]]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3764// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3765// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3766
3767// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3768// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3769
3770// CK24: call void [[CALL18:@.+]]([[SC]]* {{[^,]+}})
3771#pragma omp target map(p->s.sa[3].a)
3772 { p->a++; }
3773
3774// Region 19
3775// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE19]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE19]]{{.+}})
3776// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3777// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3778
3779// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3780// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3781// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3782// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3783// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3784// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3785// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3786// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SB]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3787// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3788
3789// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3790// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3791// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3792// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3793// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3794// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3795// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3796// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3797// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[10 x [[SA]]*]* [[SEC1111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3798// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 3
3799// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3800
3801// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3802// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3803// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3804
3805// CK24: call void [[CALL19:@.+]]([[SC]]* {{[^,]+}})
3806#pragma omp target map(p->s.sp[3]->a)
3807 { p->a++; }
3808
3809// Region 20
3810// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE20]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE20]]{{.+}})
3811// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3812// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3813
3814// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3815// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3816// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3817// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3818// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3819// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3820// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3821
3822// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3823// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3824// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3825// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3826// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3827// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3828// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0
3829// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3830// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3831
3832// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3833// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3834// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3835
3836// CK24: call void [[CALL20:@.+]]([[SC]]* {{[^,]+}})
3837#pragma omp target map(p->p->a)
3838 { p->a++; }
3839
3840// Region 21
3841// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE21]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE21]]{{.+}})
3842// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3843// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3844
3845// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3846// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3847// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3848// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3849// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3850// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3851// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:[^,]+]], i{{.+}} 0, i{{.+}} 4
3852// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3853
3854// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3855// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3856// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3857// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3858// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3859// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3860// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SA]]* [[SEC11:%[^,]+]], i{{.+}} 0
3861// CK24-DAG: [[SEC11]] = load [[SA]]*, [[SA]]** [[SEC111:%[^,]+]],
3862// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SB]]* [[SEC1111:[^,]+]], i{{.+}} 0, i{{.+}} 4
3863// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3864
3865// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3866// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3867// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3868
3869// CK24: call void [[CALL21:@.+]]([[SC]]* {{[^,]+}})
3870#pragma omp target map(p->s.p->a)
3871 { p->a++; }
3872
3873// Region 22
3874// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE22]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE22]]{{.+}})
3875// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3876// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3877
3878// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3879// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3880// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3881// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3882// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3883// CK24-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
3884// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[10 x i32]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3885// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SA]]* [[SEC000:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3886// CK24-DAG: [[SEC000]] = getelementptr {{.*}}[[SB]]* [[SEC0000:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3887// CK24-DAG: [[SEC0000]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3888
3889// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3890// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3891
3892// CK24: call void [[CALL22:@.+]]([[SC]]* {{[^,]+}})
3893#pragma omp target map(p->s.s.b[:2])
3894 { p->a++; }
3895
3896// Region 23
3897// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE23]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE23]]{{.+}})
3898// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3899// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3900
3901// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3902// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3903// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3904// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3905// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3906// CK24-DAG: [[CPVAL0]] = bitcast [[SA]]** [[SEC0:%.+]] to i8*
3907// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SB]]* [[SEC00:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3908// CK24-DAG: [[SEC00]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 1
3909
3910// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3911// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3912// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3913// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3914// CK24-DAG: [[CBPVAL1]] = bitcast [[SA]]** [[SEC0]] to i8*
3915// CK24-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
3916// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[10 x i32]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3917// CK24-DAG: [[SEC11]] = getelementptr {{.*}}[[SA]]* [[SEC111:%[^,]+]], i{{.+}} 0, i{{.+}} 2
3918// CK24-DAG: [[SEC111]] = load [[SA]]*, [[SA]]** [[SEC1111:%[^,]+]],
3919// CK24-DAG: [[SEC1111]] = getelementptr {{.*}}[[SB]]* [[SEC11111:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3920// CK24-DAG: [[SEC11111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 1
3921
3922// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3923// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3924// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3925
3926// CK24: call void [[CALL23:@.+]]([[SC]]* {{[^,]+}})
3927#pragma omp target map(p->s.p->b[:2])
3928 { p->a++; }
3929
3930// Region 24
3931// CK24-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE24]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE24]]{{.+}})
3932// CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
3933// CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
3934
3935// CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
3936// CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
3937// CK24-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
3938// CK24-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
3939// CK24-DAG: [[CBPVAL0]] = bitcast [[SC]]* [[VAR0:%.+]] to i8*
3940// CK24-DAG: [[CPVAL0]] = bitcast [[SB]]** [[SEC0:%.+]] to i8*
3941// CK24-DAG: [[SEC0]] = getelementptr {{.*}}[[SC]]* [[VAR00:%.+]], i{{.+}} 0, i{{.+}} 2
3942
3943// CK24-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
3944// CK24-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
3945// CK24-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
3946// CK24-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
3947// CK24-DAG: [[CBPVAL1]] = bitcast [[SB]]** [[SEC0]] to i8*
3948// CK24-DAG: [[CPVAL1]] = bitcast [[SA]]** [[SEC1:%.+]] to i8*
3949// CK24-DAG: [[SEC1]] = getelementptr {{.*}}[[SB]]* [[SEC11:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3950// CK24-DAG: [[SEC11]] = load [[SB]]*, [[SB]]** [[SEC111:%[^,]+]],
3951// CK24-DAG: [[SEC111]] = getelementptr {{.*}}[[SC]]* [[VAR000:%.+]], i{{.+}} 0, i{{.+}} 2
3952
3953// CK24-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
3954// CK24-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
3955// CK24-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
3956// CK24-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
3957// CK24-DAG: [[CBPVAL2]] = bitcast [[SA]]** [[SEC1]] to i8*
3958// CK24-DAG: [[CPVAL2]] = bitcast [[SA]]** [[SEC2:%.+]] to i8*
3959// CK24-DAG: [[SEC2]] = getelementptr {{.*}}[[SA]]* [[SEC22:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3960// CK24-DAG: [[SEC22]] = load [[SA]]*, [[SA]]** [[SEC222:%[^,]+]],
3961// CK24-DAG: [[SEC222]] = getelementptr {{.*}}[[SB]]* [[SEC2222:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3962// CK24-DAG: [[SEC2222]] = load [[SB]]*, [[SB]]** [[SEC22222:%[^,]+]],
3963// CK24-DAG: [[SEC22222]] = getelementptr {{.*}}[[SC]]* [[VAR0000:%.+]], i{{.+}} 0, i{{.+}} 2
3964
3965// CK24-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
3966// CK24-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
3967// CK24-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
3968// CK24-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
3969// CK24-DAG: [[CBPVAL3]] = bitcast [[SA]]** [[SEC2]] to i8*
3970// CK24-DAG: [[CPVAL3]] = bitcast i32* [[SEC3:%.+]] to i8*
3971// CK24-DAG: [[SEC3]] = getelementptr {{.*}}[[SA]]* [[SEC33:%[^,]+]], i{{.+}} 0, i{{.+}} 0
3972// CK24-DAG: [[SEC33]] = load [[SA]]*, [[SA]]** [[SEC333:%[^,]+]],
3973// CK24-DAG: [[SEC333]] = getelementptr {{.*}}[[SA]]* [[SEC3333:%[^,]+]], i{{.+}} 0, i{{.+}} 1
3974// CK24-DAG: [[SEC3333]] = load [[SA]]*, [[SA]]** [[SEC33333:%[^,]+]],
3975// CK24-DAG: [[SEC33333]] = getelementptr {{.*}}[[SB]]* [[SEC333333:%[^,]+]], i{{.+}} 0, i{{.+}} 4
3976// CK24-DAG: [[SEC333333]] = load [[SB]]*, [[SB]]** [[SEC3333333:%[^,]+]],
3977// CK24-DAG: [[SEC3333333]] = getelementptr {{.*}}[[SC]]* [[VAR00000:%.+]], i{{.+}} 0, i{{.+}} 2
3978
3979// CK24-DAG: [[VAR0]] = load [[SC]]*, [[SC]]** %{{.+}}
3980// CK24-DAG: [[VAR00]] = load [[SC]]*, [[SC]]** %{{.+}}
3981// CK24-DAG: [[VAR000]] = load [[SC]]*, [[SC]]** %{{.+}}
3982// CK24-DAG: [[VAR0000]] = load [[SC]]*, [[SC]]** %{{.+}}
3983// CK24-DAG: [[VAR00000]] = load [[SC]]*, [[SC]]** %{{.+}}
3984
3985// CK24: call void [[CALL24:@.+]]([[SC]]* {{[^,]+}})
3986#pragma omp target map(p->p->p->p->a)
3987 { p->a++; }
3988
3989 return s.a;
3990}
3991
3992// CK24: define {{.+}}[[CALL01]]
3993// CK24: define {{.+}}[[CALL02]]
3994// CK24: define {{.+}}[[CALL03]]
3995// CK24: define {{.+}}[[CALL04]]
3996// CK24: define {{.+}}[[CALL05]]
3997// CK24: define {{.+}}[[CALL06]]
3998// CK24: define {{.+}}[[CALL07]]
3999// CK24: define {{.+}}[[CALL08]]
4000// CK24: define {{.+}}[[CALL09]]
4001// CK24: define {{.+}}[[CALL10]]
4002// CK24: define {{.+}}[[CALL11]]
4003// CK24: define {{.+}}[[CALL12]]
4004// CK24: define {{.+}}[[CALL13]]
4005// CK24: define {{.+}}[[CALL14]]
4006// CK24: define {{.+}}[[CALL15]]
4007// CK24: define {{.+}}[[CALL16]]
4008// CK24: define {{.+}}[[CALL17]]
4009// CK24: define {{.+}}[[CALL18]]
4010// CK24: define {{.+}}[[CALL19]]
4011// CK24: define {{.+}}[[CALL20]]
4012// CK24: define {{.+}}[[CALL21]]
4013// CK24: define {{.+}}[[CALL22]]
4014// CK24: define {{.+}}[[CALL23]]
4015// CK24: define {{.+}}[[CALL24]]
4016#endif
4017///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004018// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-64
4019// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4020// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-64
4021// RUN: %clang_cc1 -DCK25 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-32
4022// RUN: %clang_cc1 -DCK25 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4023// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK25 --check-prefix CK25-32
Samuel Antao86ace552016-04-27 22:40:57 +00004024#ifdef CK25
4025// CK25: [[ST:%.+]] = type { i32, float }
4026// CK25: [[CA00:%.+]] = type { [[ST]]* }
4027// CK25: [[CA01:%.+]] = type { i32* }
4028
4029// CK25: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004030// CK25: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00004031
4032// CK25: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004033// CK25: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
Samuel Antao86ace552016-04-27 22:40:57 +00004034
4035// CK25-LABEL: explicit_maps_with_inner_lambda
4036
4037template <int X, typename T>
4038struct CC {
4039 T A;
4040 float B;
4041
4042 int foo(T arg) {
4043 // Region 00
4044 // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4045 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4046 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4047
4048 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4049 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4050 // CK25-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4051 // CK25-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4052 // CK25-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4053 // CK25-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4054 // CK25-DAG: [[SEC0]] = getelementptr {{.*}}[[ST]]* [[VAR0:%.+]], i{{.+}} 0, i{{.+}} 0
4055
4056 // CK25: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}})
4057 #pragma omp target map(to:A)
4058 {
4059 [&]() {
4060 A += 1;
4061 }();
4062 }
4063
4064 // Region 01
4065 // CK25-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4066 // CK25-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4067 // CK25-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4068
4069 // CK25-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4070 // CK25-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4071 // CK25-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4072 // CK25-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4073 // CK25-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
4074 // CK25-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
4075
4076 // CK25: call void [[CALL01:@.+]](i32* {{[^,]+}})
4077 #pragma omp target map(to:arg)
4078 {
4079 [&]() {
4080 arg += 1;
4081 }();
4082 }
4083
4084 return A+arg;
4085 }
4086};
4087
4088int explicit_maps_with_inner_lambda(int a){
4089 CC<123,int> c;
4090 return c.foo(a);
4091}
4092
4093// CK25: define {{.+}}[[CALL00]]([[ST]]* [[VAL:%.+]])
4094// CK25: store [[ST]]* [[VAL]], [[ST]]** [[VALADDR:%[^,]+]],
4095// CK25: [[VAL1:%.+]] = load [[ST]]*, [[ST]]** [[VALADDR]],
4096// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA00]], [[CA00]]* [[CA:%[^,]+]], i32 0, i32 0
4097// CK25: store [[ST]]* [[VAL1]], [[ST]]** [[VALADDR1]],
4098// CK25: call void {{.*}}[[LAMBDA:@.+]]{{.*}}([[CA00]]* [[CA]])
4099
4100// CK25: define {{.+}}[[LAMBDA]]
4101
4102// CK25: define {{.+}}[[CALL01]](i32* {{.*}}[[VAL:%.+]])
4103// CK25: store i32* [[VAL]], i32** [[VALADDR:%[^,]+]],
4104// CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]],
4105// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0
4106// CK25: store i32* [[VAL1]], i32** [[VALADDR1]],
4107// CK25: call void {{.*}}[[LAMBDA]]{{.*}}([[CA01]]* [[CA]])
4108#endif
4109///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004110// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
4111// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4112// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
4113// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
4114// RUN: %clang_cc1 -DCK26 -std=c++11 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4115// RUN: %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-32
Samuel Antao86ace552016-04-27 22:40:57 +00004116#ifdef CK26
4117// CK26: [[ST:%.+]] = type { i32, float*, i32, float* }
4118
4119// 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 +00004120// CK26: [[MTYPE00:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004121
4122// CK26: [[SIZE01:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004123// CK26: [[MTYPE01:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004124
4125// CK26: [[SIZE02:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004126// CK26: [[MTYPE02:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004127
4128// CK26: [[SIZE03:@.+]] = private {{.*}}constant [2 x i[[Z]]] [i[[Z]] {{32|16}}, i[[Z]] 4]
Samuel Antao6782e942016-05-26 16:48:10 +00004129// CK26: [[MTYPE03:@.+]] = private {{.*}}constant [2 x i32] [i32 35, i32 35]
Samuel Antao86ace552016-04-27 22:40:57 +00004130
4131// CK26-LABEL: explicit_maps_with_private_class_members
4132
4133struct CC {
4134 int fA;
4135 float &fB;
4136 int pA;
4137 float &pB;
4138
4139 CC(float &B) : fB(B), pB(B) {
4140
4141 // CK26: call {{.*}}@__kmpc_fork_call{{.*}} [[OUTCALL:@.+]] to void (i32*, i32*, ...)*
4142 // define {{.*}}void [[OUTCALL]]
4143 #pragma omp parallel firstprivate(fA,fB) private(pA,pB)
4144 {
4145 // Region 00
4146 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE00]]{{.+}})
4147 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4148 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4149
4150 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4151 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4152 // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4153 // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4154 // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4155 // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4156
4157 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4158 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4159 // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4160 // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4161 // CK26-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
4162 // CK26-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
4163 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4164 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4165
4166 // CK26: call void [[CALL00:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4167 #pragma omp target map(fA)
4168 {
4169 ++fA;
4170 }
4171
4172 // Region 01
4173 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE01]]{{.+}})
4174 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4175 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4176
4177 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4178 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4179 // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4180 // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4181 // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4182 // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4183
4184 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4185 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4186 // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4187 // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4188 // CK26-DAG: [[CBPVAL1]] = bitcast float* [[VAR1:%.+]] to i8*
4189 // CK26-DAG: [[CPVAL1]] = bitcast float* [[SEC1:%.+]] to i8*
4190 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4191 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4192
4193 // CK26: call void [[CALL01:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4194 #pragma omp target map(fB)
4195 {
4196 fB += 1.0;
4197 }
4198
4199 // Region 02
4200 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE02]]{{.+}})
4201 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4202 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4203
4204 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4205 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4206 // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4207 // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4208 // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4209 // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4210
4211 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4212 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4213 // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4214 // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4215 // CK26-DAG: [[CBPVAL1]] = bitcast i32* [[VAR1:%.+]] to i8*
4216 // CK26-DAG: [[CPVAL1]] = bitcast i32* [[SEC1:%.+]] to i8*
4217 // CK26-DAG: [[VAR1]] = load i32*, i32** [[PVT:%.+]],
4218 // CK26-DAG: [[SEC1]] = load i32*, i32** [[PVT]],
4219
4220 // CK26: call void [[CALL02:@.+]]([[ST]]* {{[^,]+}}, i32* {{[^,]+}})
4221 #pragma omp target map(pA)
4222 {
4223 ++pA;
4224 }
4225
4226 // Region 01
4227 // CK26-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 2, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[2 x i{{.+}}]* [[MTYPE03]]{{.+}})
4228 // CK26-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4229 // CK26-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4230
4231 // CK26-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4232 // CK26-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4233 // CK26-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4234 // CK26-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4235 // CK26-DAG: [[CBPVAL0]] = bitcast [[ST]]* [[VAR0:%.+]] to i8*
4236 // CK26-DAG: [[CPVAL0]] = bitcast [[ST]]* [[VAR0]] to i8*
4237
4238 // CK26-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4239 // CK26-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4240 // CK26-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4241 // CK26-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4242 // CK26-DAG: [[CBPVAL1]] = bitcast float* [[VAR1:%.+]] to i8*
4243 // CK26-DAG: [[CPVAL1]] = bitcast float* [[SEC1:%.+]] to i8*
4244 // CK26-DAG: [[VAR1]] = load float*, float** [[PVT:%.+]],
4245 // CK26-DAG: [[SEC1]] = load float*, float** [[PVT]],
4246
4247 // CK26: call void [[CALL03:@.+]]([[ST]]* {{[^,]+}}, float* {{[^,]+}})
4248 #pragma omp target map(pB)
4249 {
4250 pB += 1.0;
4251 }
4252 }
4253 }
4254
4255 int foo() {
4256 return fA + pA;
4257 }
4258};
4259
4260// Make sure the private instance is used in all target regions.
4261// CK26: define {{.+}}[[CALL00]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4262// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4263// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4264// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4265// CK26: add nsw i32 [[VAL]], 1
4266
4267// CK26: define {{.+}}[[CALL01]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4268// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4269// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4270// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4271// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4272// CK26: fadd double [[EXT]], 1.000000e+00
4273
4274// CK26: define {{.+}}[[CALL02]]({{.*}}i32*{{.*}}[[PVTARG:%.+]])
4275// CK26: store i32* [[PVTARG]], i32** [[PVTADDR:%.+]],
4276// CK26: [[ADDR:%.+]] = load i32*, i32** [[PVTADDR]],
4277// CK26: [[VAL:%.+]] = load i32, i32* [[ADDR]],
4278// CK26: add nsw i32 [[VAL]], 1
4279
4280// CK26: define {{.+}}[[CALL03]]({{.*}}float*{{.*}}[[PVTARG:%.+]])
4281// CK26: store float* [[PVTARG]], float** [[PVTADDR:%.+]],
4282// CK26: [[ADDR:%.+]] = load float*, float** [[PVTADDR]],
4283// CK26: [[VAL:%.+]] = load float, float* [[ADDR]],
4284// CK26: [[EXT:%.+]] = fpext float [[VAL]] to double
4285// CK26: fadd double [[EXT]], 1.000000e+00
4286
4287int explicit_maps_with_private_class_members(){
4288 float B;
4289 CC c(B);
4290 return c.foo();
4291}
4292#endif
Samuel Antao6782e942016-05-26 16:48:10 +00004293///==========================================================================///
Samuel Antao1168d63c2016-06-30 21:22:08 +00004294// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-64
4295// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4296// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-64
4297// RUN: %clang_cc1 -DCK27 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-32
4298// RUN: %clang_cc1 -DCK27 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4299// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK27 --check-prefix CK27-32
Samuel Antao6782e942016-05-26 16:48:10 +00004300#ifdef CK27
4301
4302// CK27: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] zeroinitializer
4303// CK27: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
4304
4305// CK27: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4306// CK27: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4307
4308// CK27: [[SIZE02:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4309// CK27: [[MTYPE02:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4310
4311// CK27: [[SIZE03:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4312// CK27: [[MTYPE03:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4313
Samuel Antaod486f842016-05-26 16:53:38 +00004314// CK27: [[SIZE05:@.+]] = private {{.*}}constant [1 x i[[Z]]] zeroinitializer
4315// CK27: [[MTYPE05:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
4316
4317// CK27: [[SIZE07:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 4]
4318// CK27: [[MTYPE07:@.+]] = private {{.*}}constant [1 x i32] [i32 288]
4319
4320// CK27: [[SIZE09:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 40]
4321// CK27: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i32] [i32 161]
4322
4323// CK27-LABEL: zero_size_section_and_private_maps
4324void zero_size_section_and_private_maps (int ii){
Samuel Antao6782e942016-05-26 16:48:10 +00004325
4326 // Map of a pointer.
4327 int *pa;
4328
4329 // Region 00
4330 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
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* [[VAR0:%.+]] to i8*
4339 // CK27-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
4340
4341 // CK27: call void [[CALL00:@.+]](i32* {{[^,]+}})
4342 #pragma omp target
4343 {
4344 pa[50]++;
4345 }
4346
4347 // Region 01
4348 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4349 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4350 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4351
4352 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4353 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4354 // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4355 // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4356 // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
4357 // CK27-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4358 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4359 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4360 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4361
4362 // CK27: call void [[CALL01:@.+]](i32* {{[^,]+}})
4363 #pragma omp target map(pa[:0])
4364 {
4365 pa[50]++;
4366 }
4367
4368 // Region 02
4369 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
4370 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4371 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4372
4373 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4374 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4375 // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4376 // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4377 // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
4378 // CK27-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4379 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4380 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} 0
4381 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4382
4383 // CK27: call void [[CALL02:@.+]](i32* {{[^,]+}})
4384 #pragma omp target map(pa[0:0])
4385 {
4386 pa[50]++;
4387 }
4388
4389 // Region 03
4390 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE03]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
4391 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4392 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4393
4394 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4395 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4396 // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4397 // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4398 // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[RVAR0:%.+]] to i8*
4399 // CK27-DAG: [[CPVAL0]] = bitcast i32* [[SEC0:%.+]] to i8*
4400 // CK27-DAG: [[RVAR0]] = load i32*, i32** [[VAR0:%[^,]+]]
4401 // CK27-DAG: [[SEC0]] = getelementptr {{.*}}i32* [[RVAR00:%.+]], i{{.+}} %{{.+}}
4402 // CK27-DAG: [[RVAR00]] = load i32*, i32** [[VAR0]]
4403
4404 // CK27: call void [[CALL03:@.+]](i32* {{[^,]+}})
4405 #pragma omp target map(pa[ii:0])
4406 {
4407 pa[50]++;
4408 }
Samuel Antaod486f842016-05-26 16:53:38 +00004409
4410 int *pvtPtr;
4411 int pvtScl;
4412 int pvtArr[10];
4413
4414 // Region 04
4415 // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4416 // CK27: call void [[CALL04:@.+]]()
4417 #pragma omp target private(pvtPtr)
4418 {
4419 pvtPtr[5]++;
4420 }
4421
4422 // Region 05
4423 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE05]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE05]]{{.+}})
4424 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4425 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4426
4427 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4428 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4429 // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4430 // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4431 // CK27-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
4432 // CK27-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
4433
4434 // CK27: call void [[CALL05:@.+]](i32* {{[^,]+}})
4435 #pragma omp target firstprivate(pvtPtr)
4436 {
4437 pvtPtr[5]++;
4438 }
4439
4440 // Region 06
4441 // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4442 // CK27: call void [[CALL06:@.+]]()
4443 #pragma omp target private(pvtScl)
4444 {
4445 pvtScl++;
4446 }
4447
4448 // Region 07
4449 // CK27-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZE07]]{{.+}}, {{.+}}[[MTYPE07]]{{.+}})
4450 // CK27-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0
4451 // CK27-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0
4452 // CK27-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0
4453 // CK27-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0
4454 // CK27-DAG: store i8* [[VALBP:%.+]], i8** [[BP1]],
4455 // CK27-DAG: store i8* [[VALP:%.+]], i8** [[P1]],
4456 // CK27-DAG: [[VALBP]] = inttoptr i[[Z]] [[VAL:%.+]] to i8*
4457 // CK27-DAG: [[VALP]] = inttoptr i[[Z]] [[VAL:%.+]] to i8*
4458 // CK27-DAG: [[VAL]] = load i[[Z]], i[[Z]]* [[ADDR:%.+]],
4459 // CK27-64-DAG: [[CADDR:%.+]] = bitcast i[[Z]]* [[ADDR]] to i32*
4460 // CK27-64-DAG: store i32 {{.+}}, i32* [[CADDR]],
4461
4462 // CK27: call void [[CALL07:@.+]](i[[Z]] [[VAL]])
4463 #pragma omp target firstprivate(pvtScl)
4464 {
4465 pvtScl++;
4466 }
4467
4468 // Region 08
4469 // CK27: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i32* null)
4470 // CK27: call void [[CALL08:@.+]]()
4471 #pragma omp target private(pvtArr)
4472 {
4473 pvtArr[5]++;
4474 }
4475
4476 // Region 09
4477 // CK27-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}})
4478 // CK27-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4479 // CK27-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4480
4481 // CK27-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4482 // CK27-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4483 // CK27-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4484 // CK27-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4485 // CK27-DAG: [[CBPVAL0]] = bitcast [10 x i32]* [[VAR0:%.+]] to i8*
4486 // CK27-DAG: [[CPVAL0]] = bitcast [10 x i32]* [[VAR0]] to i8*
4487
4488 // CK27: call void [[CALL09:@.+]]([10 x i32]* {{[^,]+}})
4489 #pragma omp target firstprivate(pvtArr)
4490 {
4491 pvtArr[5]++;
4492 }
Samuel Antao6782e942016-05-26 16:48:10 +00004493}
4494
4495// CK27: define {{.+}}[[CALL00]]
4496// CK27: define {{.+}}[[CALL01]]
4497// CK27: define {{.+}}[[CALL02]]
4498// CK27: define {{.+}}[[CALL03]]
Samuel Antaod486f842016-05-26 16:53:38 +00004499// CK27: define {{.+}}[[CALL04]]
4500// CK27: define {{.+}}[[CALL05]]
4501// CK27: define {{.+}}[[CALL06]]
4502// CK27: define {{.+}}[[CALL07]]
Samuel Antao6782e942016-05-26 16:48:10 +00004503#endif
Samuel Antao403ffd42016-07-27 22:49:49 +00004504///==========================================================================///
4505// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-64
4506// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4507// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-64
4508// RUN: %clang_cc1 -DCK28 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-32
4509// RUN: %clang_cc1 -DCK28 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4510// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK28 --check-prefix CK28-32
4511#ifdef CK28
4512
4513// CK28: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] {{8|4}}]
4514// CK28: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4515
4516// CK28: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
4517// CK28: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 35]
4518
4519// CK28-LABEL: explicit_maps_pointer_references
4520void explicit_maps_pointer_references (int *p){
4521 int *&a = p;
4522
4523 // Region 00
4524 // CK28-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
4525 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4526 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4527
4528 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4529 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4530 // CK28-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4531 // CK28-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4532 // CK28-DAG: [[CBPVAL0]] = bitcast i32** [[VAR0:%.+]] to i8*
4533 // CK28-DAG: [[CPVAL0]] = bitcast i32** [[VAR1:%.+]] to i8*
4534 // CK28-DAG: [[VAR0]] = load i32**, i32*** [[VAR00:%.+]],
4535 // CK28-DAG: [[VAR1]] = load i32**, i32*** [[VAR11:%.+]],
4536
4537 // CK28: call void [[CALL00:@.+]](i32** {{[^,]+}})
4538 #pragma omp target map(a)
4539 {
4540 ++a;
4541 }
4542
4543 // Region 01
4544 // CK28-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}})
4545 // CK28-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4546 // CK28-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4547
4548 // CK28-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4549 // CK28-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4550 // CK28-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4551 // CK28-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4552 // CK28-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
4553 // CK28-DAG: [[CPVAL0]] = bitcast i32* [[VAR1:%.+]] to i8*
4554 // CK28-DAG: [[VAR0]] = load i32*, i32** [[VAR00:%.+]],
4555 // CK28-DAG: [[VAR00]] = load i32**, i32*** [[VAR000:%.+]],
4556 // CK28-DAG: [[VAR1]] = getelementptr inbounds i32, i32* [[VAR11:%.+]], i{{64|32}} 2
4557 // CK28-DAG: [[VAR11]] = load i32*, i32** [[VAR111:%.+]],
4558 // CK28-DAG: [[VAR111]] = load i32**, i32*** [[VAR1111:%.+]],
4559
4560 // CK28: call void [[CALL01:@.+]](i32* {{[^,]+}})
4561 #pragma omp target map(a[2:100])
4562 {
4563 ++a;
4564 }
4565}
4566#endif
Samuel Antao03a3cec2016-07-27 22:52:16 +00004567///==========================================================================///
4568// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-64
4569// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4570// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-64
4571// RUN: %clang_cc1 -DCK29 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-32
4572// RUN: %clang_cc1 -DCK29 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
4573// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK29 --check-prefix CK29-32
4574#ifdef CK29
4575
4576// CK29: [[SSA:%.+]] = type { double*, double** }
4577// CK29: [[SSB:%.+]] = type { [[SSA]]*, [[SSA]]** }
4578
4579// CK29: [[SIZE00:@.+]] = private {{.*}}constant [4 x i[[Z:64|32]]] [i[[Z:64|32]] {{8|4}}, i[[Z:64|32]] {{8|4}}, i[[Z:64|32]] {{8|4}}, i[[Z:64|32]] 80]
4580// CK29: [[MTYPE00:@.+]] = private {{.*}}constant [4 x i32] [i32 35, i32 16, i32 19, i32 19]
4581
4582// CK29: [[SIZE01:@.+]] = private {{.*}}constant [4 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 80]
4583// CK29: [[MTYPE01:@.+]] = private {{.*}}constant [4 x i32] [i32 32, i32 19, i32 19, i32 19]
4584
4585// CK29: [[SIZE02:@.+]] = private {{.*}}constant [5 x i[[Z]]] [i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] {{8|4}}, i[[Z]] 80]
4586// CK29: [[MTYPE02:@.+]] = private {{.*}}constant [5 x i32] [i32 32, i32 19, i32 16, i32 19, i32 19]
4587
4588struct SSA{
4589 double *p;
4590 double *&pr;
4591 SSA(double *&pr) : pr(pr) {}
4592};
4593
4594struct SSB{
4595 SSA *p;
4596 SSA *&pr;
4597 SSB(SSA *&pr) : pr(pr) {}
4598
4599 // CK29-LABEL: define {{.+}}foo
4600 void foo() {
4601
4602 // Region 00
4603 // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE00]]{{.+}})
4604
4605 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4606 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4607
4608 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4609 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4610 // CK29-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4611 // CK29-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4612 // CK29-DAG: [[CBPVAL0]] = bitcast [[SSB]]* [[VAR0:%.+]] to i8*
4613 // CK29-DAG: [[CPVAL0]] = bitcast [[SSA]]** [[VAR00:%.+]] to i8*
4614 // CK29-DAG: [[VAR0]] = load [[SSB]]*, [[SSB]]** %
4615 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 0
4616
4617 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4618 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4619 // CK29-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4620 // CK29-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4621 // CK29-DAG: [[CBPVAL1]] = bitcast [[SSA]]** [[VAR00]] to i8*
4622 // CK29-DAG: [[CPVAL1]] = bitcast double*** [[VAR1:%.+]] to i8*
4623 // CK29-DAG: [[VAR1]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4624
4625 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4626 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
4627 // CK29-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
4628 // CK29-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
4629 // CK29-DAG: [[CBPVAL2]] = bitcast double*** [[VAR1]] to i8*
4630 // CK29-DAG: [[CPVAL2]] = bitcast double** [[VAR2:%.+]] to i8*
4631 // CK29-DAG: [[VAR2]] = load double**, double*** [[VAR22:%.+]],
4632 // CK29-DAG: [[VAR22]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4633
4634 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4635 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
4636 // CK29-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
4637 // CK29-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
4638 // CK29-DAG: [[CBPVAL3]] = bitcast double** [[VAR2]] to i8*
4639 // CK29-DAG: [[CPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
4640 // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4641 // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4642
4643 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4644 #pragma omp target map(p->pr[:10])
4645 {
4646 p->pr++;
4647 }
4648
4649 // Region 01
4650 // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 4, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[4 x i{{.+}}]* [[MTYPE01]]{{.+}})
4651
4652 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4653 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4654
4655 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4656 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4657 // CK29-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4658 // CK29-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4659 // CK29-DAG: [[CBPVAL0]] = bitcast [[SSB]]* [[VAR0:%.+]] to i8*
4660 // CK29-DAG: [[CPVAL0]] = bitcast [[SSA]]*** [[VAR00:%.+]] to i8*
4661 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4662
4663 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4664 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4665 // CK29-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4666 // CK29-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4667 // CK29-DAG: [[CBPVAL1]] = bitcast [[SSA]]*** [[VAR00]] to i8*
4668 // CK29-DAG: [[CPVAL1]] = bitcast [[SSA]]** [[VAR1:%.+]] to i8*
4669 // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4670
4671 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4672 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
4673 // CK29-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
4674 // CK29-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
4675 // CK29-DAG: [[CBPVAL2]] = bitcast [[SSA]]** [[VAR1]] to i8*
4676 // CK29-DAG: [[CPVAL2]] = bitcast double** [[VAR2:%.+]] to i8*
4677 // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 0
4678
4679 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4680 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
4681 // CK29-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
4682 // CK29-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
4683 // CK29-DAG: [[CBPVAL3]] = bitcast double** [[VAR2]] to i8*
4684 // CK29-DAG: [[CPVAL3]] = bitcast double* [[VAR3:%.+]] to i8*
4685 // CK29-DAG: [[VAR3]] = getelementptr inbounds double, double* [[VAR33:%.+]], i{{.+}} 0
4686 // CK29-DAG: [[VAR33]] = load double*, double** %{{.+}},
4687
4688 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4689 #pragma omp target map(pr->p[:10])
4690 {
4691 pr->p++;
4692 }
4693
4694 // Region 02
4695 // CK29-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 5, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[5 x i{{.+}}]* [[MTYPE02]]{{.+}})
4696
4697 // CK29-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
4698 // CK29-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
4699
4700 // CK29-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
4701 // CK29-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
4702 // CK29-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
4703 // CK29-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
4704 // CK29-DAG: [[CBPVAL0]] = bitcast [[SSB]]* [[VAR0:%.+]] to i8*
4705 // CK29-DAG: [[CPVAL0]] = bitcast [[SSA]]*** [[VAR00:%.+]] to i8*
4706 // CK29-DAG: [[VAR00]] = getelementptr inbounds [[SSB]], [[SSB]]* [[VAR0]], i32 0, i32 1
4707
4708 // CK29-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 1
4709 // CK29-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 1
4710 // CK29-DAG: store i8* [[CBPVAL1:%[^,]+]], i8** [[BP1]]
4711 // CK29-DAG: store i8* [[CPVAL1:%[^,]+]], i8** [[P1]]
4712 // CK29-DAG: [[CBPVAL1]] = bitcast [[SSA]]*** [[VAR00]] to i8*
4713 // CK29-DAG: [[CPVAL1]] = bitcast [[SSA]]** [[VAR1:%.+]] to i8*
4714 // CK29-DAG: [[VAR1]] = load [[SSA]]**, [[SSA]]*** [[VAR00]],
4715
4716 // CK29-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 2
4717 // CK29-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 2
4718 // CK29-DAG: store i8* [[CBPVAL2:%[^,]+]], i8** [[BP2]]
4719 // CK29-DAG: store i8* [[CPVAL2:%[^,]+]], i8** [[P2]]
4720 // CK29-DAG: [[CBPVAL2]] = bitcast [[SSA]]** [[VAR1]] to i8*
4721 // CK29-DAG: [[CPVAL2]] = bitcast double*** [[VAR2:%.+]] to i8*
4722 // CK29-DAG: [[VAR2]] = getelementptr inbounds [[SSA]], [[SSA]]* %{{.+}}, i32 0, i32 1
4723
4724 // CK29-DAG: [[BP3:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 3
4725 // CK29-DAG: [[P3:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 3
4726 // CK29-DAG: store i8* [[CBPVAL3:%[^,]+]], i8** [[BP3]]
4727 // CK29-DAG: store i8* [[CPVAL3:%[^,]+]], i8** [[P3]]
4728 // CK29-DAG: [[CBPVAL3]] = bitcast double*** [[VAR2]] to i8*
4729 // CK29-DAG: [[CPVAL3]] = bitcast double** [[VAR3:%.+]] to i8*
4730 // CK29-DAG: [[VAR3]] = load double**, double*** [[VAR2]],
4731
4732 // CK29-DAG: [[BP4:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 4
4733 // CK29-DAG: [[P4:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 4
4734 // CK29-DAG: store i8* [[CBPVAL4:%[^,]+]], i8** [[BP4]]
4735 // CK29-DAG: store i8* [[CPVAL4:%[^,]+]], i8** [[P4]]
4736 // CK29-DAG: [[CBPVAL4]] = bitcast double** [[VAR3]] to i8*
4737 // CK29-DAG: [[CPVAL4]] = bitcast double* [[VAR4:%.+]] to i8*
4738 // CK29-DAG: [[VAR4]] = getelementptr inbounds double, double* [[VAR44:%.+]], i{{.+}} 0
4739 // CK29-DAG: [[VAR44]] = load double*, double**
4740
4741 // CK29: call void [[CALL00:@.+]]([[SSB]]* {{[^,]+}})
4742 #pragma omp target map(pr->pr[:10])
4743 {
4744 pr->pr++;
4745 }
4746 }
4747};
4748
4749void explicit_maps_member_pointer_references(SSA *sap) {
4750 double *d;
4751 SSA sa(d);
4752 SSB sb(sap);
4753 sb.foo();
4754}
4755#endif
Samuel Antao4af1b7b2015-12-02 17:44:43 +00004756#endif