Files
clang-p2996/openmp/libomptarget/test/jit/empty_kernel.inc
Johannes Doerfert bda72457a8 [OpenMP] Add JIT and IR tests
The OpenMP target JIT needs testing, so does the IR we actually generate
for the device. This is the initial commit with variations of an "empty
OpenMP kernel" that should all result in a empty IR kernel.

Differential revision: https://reviews.llvm.org/D150623
2023-05-18 13:27:43 -07:00

42 lines
794 B
C++

int main(int argc, char** argv) {
#pragma omp TGT1_DIRECTIVE
{
#ifdef LOOP_DIRECTIVE
#pragma omp LOOP_DIRECTIVE
for (int i = 0; i < argc; ++i)
#endif
{
#ifdef BODY_DIRECTIVE
#pragma omp BODY_DIRECTIVE
{
}
#endif
}
}
#ifdef TGT2_DIRECTIVE
#pragma omp TGT2_DIRECTIVE
{
#ifdef LOOP_DIRECTIVE
#pragma omp LOOP_DIRECTIVE
for (int i = 0; i < argc; ++i)
#endif
{
#ifdef BODY_DIRECTIVE
#pragma omp BODY_DIRECTIVE
{
}
#endif
}
}
#endif
}
// Check for an empty kernel (IR level)
// FIRST: define weak_odr {{.*}} void @__omp_offloading_{{.*}}_main
// FIRST-NEXT: ret void
// Check for two empty kernels (IR level)
// SECOND: define weak_odr {{.*}} void @__omp_offloading_{{.*}}_main
// SECOND-NEXT: ret void