1 // RUN: %clang_cc1 -x hip -emit-llvm -std=c++11 %s -o - \
2 // RUN: -triple x86_64-linux-gnu \
3 // RUN: | FileCheck -check-prefix=HOST %s
4 // RUN: %clang_cc1 -x hip -emit-llvm -std=c++11 %s -o - \
5 // RUN: -triple amdgcn-amd-amdhsa -fcuda-is-device \
6 // RUN: | FileCheck -check-prefix=DEV %s
8 #include "Inputs/cuda.h"
10 // Checks noinline is correctly added to the lambda function.
12 // HOST: define{{.*}}@_ZZ4HostvENKUlvE_clEv({{.*}}) #[[ATTR:[0-9]+]]
13 // HOST: attributes #[[ATTR]]{{.*}}noinline
15 // DEV: define{{.*}}@_ZZ6DevicevENKUlvE_clEv({{.*}}) #[[ATTR:[0-9]+]]
16 // DEV: attributes #[[ATTR]]{{.*}}noinline
21 __device__ int Device() { return ([&] __device__ __noinline__ (){ return a; })(); }
23 __host__ int Host() { return ([&] __host__ __noinline__ (){ return b; })(); }