This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG6b868139458d: [SYCL] Always set NoUnwind attribute for SYCL. (authored by hvdijk).
Changed prior to commit: https://reviews.llvm.org/D147097?vs=509355&id=509528#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D147097/new/ https://reviews.llvm.org/D147097 Files: clang/lib/CodeGen/CGCall.cpp clang/test/CodeGenSYCL/convergent.cpp clang/test/CodeGenSYCL/function-attrs.cpp Index: clang/test/CodeGenSYCL/function-attrs.cpp =================================================================== --- /dev/null +++ clang/test/CodeGenSYCL/function-attrs.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -disable-llvm-passes \ +// RUN: -triple spir64 -fexceptions -emit-llvm %s -o - | FileCheck %s + +int foo(); + +// CHECK: define dso_local spir_func void @_Z3barv() [[BAR:#[0-9]+]] +// CHECK: attributes [[BAR]] = +// CHECK-SAME: convergent +// CHECK-SAME: nounwind +void bar() { + int a = foo(); +} + +int foo() { + return 1; +} + +template <typename Name, typename Func> +__attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) { + kernelFunc(); +} + +int main() { + kernel_single_task<class fake_kernel>([] { bar(); }); + return 0; +} Index: clang/test/CodeGenSYCL/convergent.cpp =================================================================== --- clang/test/CodeGenSYCL/convergent.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -disable-llvm-passes \ -// RUN: -triple spir64 -emit-llvm %s -o - | FileCheck %s - -// CHECK-DAG: Function Attrs: -// CHECK-DAG-SAME: convergent -// CHECK-DAG-NEXT: define void @_Z3foov -void foo() { - int a = 1; -} - -template <typename Name, typename Func> -__attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) { - kernelFunc(); -} - -int main() { - kernel_single_task<class fake_kernel>([] { foo(); }); - return 0; -} Index: clang/lib/CodeGen/CGCall.cpp =================================================================== --- clang/lib/CodeGen/CGCall.cpp +++ clang/lib/CodeGen/CGCall.cpp @@ -1971,10 +1971,9 @@ } // TODO: NoUnwind attribute should be added for other GPU modes HIP, - // SYCL, OpenMP offload. AFAIK, none of them support exceptions in device - // code. + // OpenMP offload. AFAIK, neither of them support exceptions in device code. if ((getLangOpts().CUDA && getLangOpts().CUDAIsDevice) || - getLangOpts().OpenCL) { + getLangOpts().OpenCL || getLangOpts().SYCLIsDevice) { FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); }
Index: clang/test/CodeGenSYCL/function-attrs.cpp =================================================================== --- /dev/null +++ clang/test/CodeGenSYCL/function-attrs.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -disable-llvm-passes \ +// RUN: -triple spir64 -fexceptions -emit-llvm %s -o - | FileCheck %s + +int foo(); + +// CHECK: define dso_local spir_func void @_Z3barv() [[BAR:#[0-9]+]] +// CHECK: attributes [[BAR]] = +// CHECK-SAME: convergent +// CHECK-SAME: nounwind +void bar() { + int a = foo(); +} + +int foo() { + return 1; +} + +template <typename Name, typename Func> +__attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) { + kernelFunc(); +} + +int main() { + kernel_single_task<class fake_kernel>([] { bar(); }); + return 0; +} Index: clang/test/CodeGenSYCL/convergent.cpp =================================================================== --- clang/test/CodeGenSYCL/convergent.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -disable-llvm-passes \ -// RUN: -triple spir64 -emit-llvm %s -o - | FileCheck %s - -// CHECK-DAG: Function Attrs: -// CHECK-DAG-SAME: convergent -// CHECK-DAG-NEXT: define void @_Z3foov -void foo() { - int a = 1; -} - -template <typename Name, typename Func> -__attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) { - kernelFunc(); -} - -int main() { - kernel_single_task<class fake_kernel>([] { foo(); }); - return 0; -} Index: clang/lib/CodeGen/CGCall.cpp =================================================================== --- clang/lib/CodeGen/CGCall.cpp +++ clang/lib/CodeGen/CGCall.cpp @@ -1971,10 +1971,9 @@ } // TODO: NoUnwind attribute should be added for other GPU modes HIP, - // SYCL, OpenMP offload. AFAIK, none of them support exceptions in device - // code. + // OpenMP offload. AFAIK, neither of them support exceptions in device code. if ((getLangOpts().CUDA && getLangOpts().CUDAIsDevice) || - getLangOpts().OpenCL) { + getLangOpts().OpenCL || getLangOpts().SYCLIsDevice) { FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits