| 1 |
// RUN: %clang_cc1 -verify -triple x86_64-pc-linux-gnu -fopenmp-targets=amdgcn-amd-amdhsa -fopenmp -emit-llvm %s -o - | FileCheck %s |
| 2 |
// expected-no-diagnostics |
| 3 |
|
| 4 |
struct S { |
| 5 |
int x; |
| 6 |
int y; |
| 7 |
int z; |
| 8 |
}; |
| 9 |
|
| 10 |
struct T : public S { |
| 11 |
int a; |
| 12 |
int b; |
| 13 |
int c; |
| 14 |
}; |
| 15 |
|
| 16 |
int main() { |
| 17 |
T v; |
| 18 |
|
| 19 |
// This one should have no gap between v.z & v.a. |
| 20 |
#pragma omp target map(tofrom: v, v.y, v.z, v.a) |
| 21 |
{ |
| 22 |
v.y++; |
| 23 |
v.z += 2; |
| 24 |
v.a += 3; |
| 25 |
} |
| 26 |
|
| 27 |
return 0; |
| 28 |
} |
| 29 |
|
| 30 |
// CHECK: [[CSTSZ:@.+]] = private {{.*}}constant [6 x i64] [i64 0, i64 0, i64 0, i64 4, i64 4, i64 4] |
| 31 |
// CHECK: [[CSTTY:@.+]] = private {{.*}}constant [6 x i64] [i64 [[#0x20]], i64 [[#0x1000000000003]], i64 [[#0x1000000000003]], i64 [[#0x1000000000003]], i64 [[#0x1000000000003]], i64 [[#0x1000000000003]]] |
| 32 |
|
| 33 |
// CHECK-DAG: call i32 @__tgt_target_kernel(ptr @{{.+}}, i64 -1, i32 -1, i32 0, ptr @.{{.+}}.region_id, ptr [[ARGS:%.+]]) |
| 34 |
// CHECK-DAG: [[KSIZE:%.+]] = getelementptr inbounds {{.+}}[[ARGS]], i32 0, i32 4 |
| 35 |
// CHECK-DAG: store ptr [[SZBASE:%.+]], ptr [[KSIZE]], align 8 |
| 36 |
// CHECK-DAG: [[SZBASE]] = getelementptr inbounds [6 x i64], ptr [[SIZES:%[^,]*]], i32 0, i32 0 |
| 37 |
|
| 38 |
// Fill three non-constant size elements here: the whole struct size, the region |
| 39 |
// covering v.x, and the region covering v.b and v.c. |
| 40 |
|
| 41 |
// CHECK-DAG: [[STR:%.+]] = getelementptr inbounds [6 x i64], ptr [[SIZES]], i32 0, i32 0 |
| 42 |
// CHECK-DAG: store i64 %{{.+}}, ptr [[STR]], align 8 |
| 43 |
// CHECK-DAG: [[X:%.+]] = getelementptr inbounds [6 x i64], ptr [[SIZES]], i32 0, i32 1 |
| 44 |
// CHECK-DAG: store i64 %{{.+}}, ptr [[X]], align 8 |
| 45 |
// CHECK-DAG: [[BC:%.+]] = getelementptr inbounds [6 x i64], ptr [[SIZES]], i32 0, i32 2 |
| 46 |
// CHECK-DAG: store i64 %{{.+}}, ptr [[BC]], align 8 |