1 // Uses -O2 since the defalt -O0 option adds noinline to all functions. 2 3 // RUN: %clang_cc1 -triple nvptx-nvidia-cuda -fcuda-is-device \ 4 // RUN: -O2 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s 5 6 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device \ 7 // RUN: -O2 -disable-llvm-passes -emit-llvm -o - -x hip %s | FileCheck %s 8 9 // RUN: %clang_cc1 -triple x86_64-unknown-gnu-linux \ 10 // RUN: -O2 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s 11 12 #include "Inputs/cuda.h" 13 fun1()14__noinline__ __device__ __host__ void fun1() {} 15 fun2()16__attribute__((noinline)) __device__ __host__ void fun2() {} 17 fun3()18__attribute__((__noinline__)) __device__ __host__ void fun3() {} 19 fun4()20[[gnu::__noinline__]] __device__ __host__ void fun4() {} 21 22 #define __noinline__ __attribute__((__noinline__)) fun5()23__noinline__ __device__ __host__ void fun5() {} 24 fun6()25__device__ __host__ void fun6() {} 26 27 // CHECK: define{{.*}}@_Z4fun1v{{.*}}#[[ATTR1:[0-9]*]] 28 // CHECK: define{{.*}}@_Z4fun2v{{.*}}#[[ATTR1:[0-9]*]] 29 // CHECK: define{{.*}}@_Z4fun3v{{.*}}#[[ATTR1:[0-9]*]] 30 // CHECK: define{{.*}}@_Z4fun4v{{.*}}#[[ATTR1:[0-9]*]] 31 // CHECK: define{{.*}}@_Z4fun5v{{.*}}#[[ATTR1:[0-9]*]] 32 // CHECK: define{{.*}}@_Z4fun6v{{.*}}#[[ATTR2:[0-9]*]] 33 // CHECK: attributes #[[ATTR1]] = {{.*}}noinline 34 // CHECK-NOT: attributes #[[ATTR2]] = {{.*}}noinline 35