Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / nvptx_NRVO_variable.cpp
blob010b43c2f5dab3ae45e3dd21edcccaabee739e87
1 // Test target codegen - host bc file has to be created first.
2 // 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
3 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
4 // expected-no-diagnostics
5 #ifndef HEADER
6 #define HEADER
8 struct S {
9 int a;
10 S() : a(1) {}
13 #pragma omp declare target
14 void bar(S &);
15 // CHECK-LABEL: foo
16 S foo() {
17 // CHECK: [[RETVAL:%.+]] = alloca %struct.S,
18 S s;
19 // CHECK: call void @{{.+}}bar{{.+}}(ptr {{.*}}[[S_REF:%.+]])
20 bar(s);
21 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}[[RETVAL]], ptr {{.*}}[[S_REF]], i64 4, i1 false)
22 // CHECK: [[VAL:%.+]] = load %struct.S, ptr [[RETVAL]],
23 // CHECK: ret %struct.S [[VAL]]
24 return s;
26 #pragma omp end declare target
28 #endif