
At the moment, Clang is rather liberal in assuming that 0 (and by extension unqualified) is always a safe default. This does not work for targets that actually use a different value for the default / generic AS (for example, the SPIRV that obtains from HIPSPV or SYCL). This patch is a first, fairly safe step towards trying to clear things up by querying a modules' default AS from the target, rather than assuming it's 0, alongside fixing a few places where things break / we encode the 0 == DefaultAS assumption. A bunch of existing tests are extended to check for non-zero default AS usage.
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-unknown-unknown -fsycl-is-device -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)))
|
|
}
|
|
}
|