aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorSven van Haastregt <sven.vanhaastregt@arm.com>2023-01-19 13:42:43 +0000
committerSven van Haastregt <sven.vanhaastregt@arm.com>2023-01-20 12:01:22 +0000
commit1495210914997bcd0ca6937be0ae3cd6809b5ef5 (patch)
tree12c5fb4718f0a7c5a3d38b3b6aa5012fa8647ce6 /clang/lib/CodeGen/CGCall.cpp
parent06ade34c4bf8378f960b7e7564f1ba2316f6a990 (diff)
downloadllvm-1495210914997bcd0ca6937be0ae3cd6809b5ef5.zip
llvm-1495210914997bcd0ca6937be0ae3cd6809b5ef5.tar.gz
llvm-1495210914997bcd0ca6937be0ae3cd6809b5ef5.tar.bz2
[OpenCL] Always add nounwind attribute for OpenCL
Neither OpenCL nor C++ for OpenCL support exceptions, so add the `nounwind` attribute unconditionally for those languages. Differential Revision: https://reviews.llvm.org/D142033
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 276d91f..dfa5521 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1969,11 +1969,11 @@ void CodeGenModule::getDefaultFunctionAttributes(StringRef Name,
FuncAttrs.addAttribute(llvm::Attribute::Convergent);
}
- // TODO: NoUnwind attribute should be added for other GPU modes OpenCL, HIP,
+ // TODO: NoUnwind attribute should be added for other GPU modes HIP,
// SYCL, OpenMP offload. AFAIK, none of them support exceptions in device
// code.
- if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) {
- // Exceptions aren't supported in CUDA device code.
+ if ((getLangOpts().CUDA && getLangOpts().CUDAIsDevice) ||
+ getLangOpts().OpenCL) {
FuncAttrs.addAttribute(llvm::Attribute::NoUnwind);
}