[OpenMP][SPIRV] Disable exceptions for OpenMP SPIR-V (#169094)
More missed target checks. Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
This commit is contained in:
parent
ad0acf4af0
commit
71952df1f5
@ -450,7 +450,7 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E,
|
||||
// Therefore, we emit a trap which will abort the program, and
|
||||
// prompt a warning indicating that a trap will be emitted.
|
||||
const llvm::Triple &T = Target.getTriple();
|
||||
if (CGM.getLangOpts().OpenMPIsTargetDevice && (T.isNVPTX() || T.isAMDGCN())) {
|
||||
if (CGM.getLangOpts().OpenMPIsTargetDevice && T.isGPU()) {
|
||||
EmitTrapCall(llvm::Intrinsic::trap);
|
||||
return;
|
||||
}
|
||||
@ -627,7 +627,7 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) {
|
||||
// If we encounter a try statement on in an OpenMP target region offloaded to
|
||||
// a GPU, we treat it as a basic block.
|
||||
const bool IsTargetDevice =
|
||||
(CGM.getLangOpts().OpenMPIsTargetDevice && (T.isNVPTX() || T.isAMDGCN()));
|
||||
(CGM.getLangOpts().OpenMPIsTargetDevice && T.isGPU());
|
||||
if (!IsTargetDevice)
|
||||
EnterCXXTryStmt(S);
|
||||
EmitStmt(S.getTryBlock());
|
||||
|
||||
@ -4293,8 +4293,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
|
||||
// Set the flag to prevent the implementation from emitting device exception
|
||||
// handling code for those requiring so.
|
||||
if ((Opts.OpenMPIsTargetDevice && (T.isNVPTX() || T.isAMDGCN())) ||
|
||||
Opts.OpenCLCPlusPlus) {
|
||||
if ((Opts.OpenMPIsTargetDevice && T.isGPU()) || Opts.OpenCLCPlusPlus) {
|
||||
|
||||
Opts.Exceptions = 0;
|
||||
Opts.CXXExceptions = 0;
|
||||
|
||||
9
clang/test/OpenMP/spirv_target_codegen_noexceptions.cpp
Normal file
9
clang/test/OpenMP/spirv_target_codegen_noexceptions.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -Wno-openmp-target-exception -fopenmp -x c++ -triple x86_64-unknown-linux -fopenmp-targets=spirv64-intel -emit-llvm-bc %s -o %t-host.bc
|
||||
// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -Wno-openmp-target-exception -fopenmp -x c++ -triple spirv64-intel -fopenmp-targets=spirv64-intel -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-host.bc -o - | \
|
||||
// RUN: FileCheck -implicit-check-not='{{invoke|throw|cxa}}' %s
|
||||
void foo() {
|
||||
// CHECK: call addrspace(9) void @llvm.trap()
|
||||
// CHECK-NEXT: call spir_func addrspace(9) void @__kmpc_target_deinit()
|
||||
#pragma omp target
|
||||
throw "bad";
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user