[OpenCL][CUDA][HIP][SYCL] Add norecurse
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Wed, 29 Jan 2020 19:11:37 +0000 (14:11 -0500)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Mon, 17 Feb 2020 01:41:00 +0000 (20:41 -0500)
commitfb44b9db95a333efdfa9a33ddc1778f97428f5f5
treecb74d1729604e8248e0f389cb047d83bdd5a03b9
parent20c5968e0953d978be4d9d1062801e8758c393b5
[OpenCL][CUDA][HIP][SYCL] Add norecurse

norecurse function attr indicates the function is not called recursively
directly or indirectly.

Add norecurse to OpenCL functions, SYCL functions in device compilation
and CUDA/HIP kernels.

Although there is LLVM pass adding norecurse to functions, it only works
for whole-program compilation. Also FE adding norecurse can make that
pass run faster since functions with norecurse do not need to be checked
again.

Differential Revision: https://reviews.llvm.org/D73651
clang/lib/CodeGen/CodeGenFunction.cpp
clang/test/CodeGenCUDA/norecurse.cu [new file with mode: 0644]
clang/test/CodeGenCUDA/propagate-metadata.cu
clang/test/CodeGenOpenCL/amdgpu-attrs.cl
clang/test/CodeGenOpenCL/norecurse.cl [new file with mode: 0644]
clang/test/SemaCUDA/call-kernel-from-kernel.cu [new file with mode: 0644]