llvm/clang/test/OpenMP/nvptx_param_translate.c
Alexey Bataev a28e835e94 [OPENMP]Fix PR48885: Crash in passing firstprivate args to tasks on Apple M1.
Need to bitcast the function pointer passed as a parameter to the real
type to avoid possible problem with calling conventions.

Differential Revision: https://reviews.llvm.org/D99521
2021-03-31 13:00:58 -07:00

21 lines
784 B
C

// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
// expected-no-diagnostics
// CHECK: [[MAP_FN:%.+]] = load void (i8*, ...)*, void (i8*, ...)** %
// CHECK: [[FN:%.+]] = bitcast void (i8*, ...)* [[MAP_FN]] to void (i8*,
// CHECK: call void [[FN]](i8* %
int main() {
double a, b;
#pragma omp target map(tofrom \
: a) map(to \
: b)
{
#pragma omp taskgroup
#pragma omp task shared(a)
a = b;
}
return 0;
}