mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 09:06:06 +00:00

This is primarily meant to address the issue identified in #109182, around incorrect usage of `-fsycl-is-device`; we now have AMDGCN flavoured SPIR-V which retains the desired behaviour around the default AS and does not depend on the SYCL language being enabled to do so. Overall, there are three changes: 1. We unconditionally use the `SPIRDefIsGen` AS map for AMDGCNSPIRV target, as there is no case where the hack of setting default to private would be desirable, and it can be used for languages other than OCL/HIP; 2. We implement `SPIRVTargetCodeGenInfo::getGlobalVarAddressSpace` for SPIR-V in general, because otherwise using it from languages other than HIP or OpenCL would yield 0, incorrectly; 3. We remove the incorrect usage of `-fsycl-is-device`.
29 lines
1.1 KiB
C++
29 lines
1.1 KiB
C++
// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
|
|
// RUN: %clang_cc1 %s -triple=spirv64-amd-amdhsa -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s --check-prefix=WITH-NONZERO-DEFAULT-AS
|
|
|
|
struct X { };
|
|
|
|
const X g();
|
|
|
|
void f() {
|
|
try {
|
|
throw g();
|
|
// CHECK: ptr addrspace(1) @_ZTI1X
|
|
} catch (const X x) {
|
|
// CHECK: catch ptr addrspace(1) @_ZTI1X
|
|
// CHECK: call i32 @llvm.eh.typeid.for.p0(ptr addrspacecast (ptr addrspace(1) @_ZTI1X to ptr))
|
|
// WITH-NONZERO-DEFAULT-AS: call{{.*}} i32 @llvm.eh.typeid.for.p4(ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTI1X to ptr addrspace(4)))
|
|
}
|
|
}
|
|
|
|
void h() {
|
|
try {
|
|
throw "ABC";
|
|
// CHECK: ptr addrspace(1) @_ZTIPKc
|
|
} catch (char const(&)[4]) {
|
|
// CHECK: catch ptr addrspace(1) @_ZTIA4_c
|
|
// CHECK: call i32 @llvm.eh.typeid.for.p0(ptr addrspacecast (ptr addrspace(1) @_ZTIA4_c to ptr))
|
|
// WITH-NONZERO-DEFAULT-AS: call{{.*}} i32 @llvm.eh.typeid.for.p4(ptr addrspace(4) addrspacecast (ptr addrspace(1) @_ZTIA4_c to ptr addrspace(4)))
|
|
}
|
|
}
|