Add test for addrspacecasting global vars

Global variables are casted to the default address space works,
as the amdgpu target is now merged, a test can be added.
This commit is contained in:
Flakebi
2025-09-03 08:29:52 +02:00
parent 94722cabf4
commit 485bdafdcf
2 changed files with 17 additions and 1 deletions

View File

@@ -179,7 +179,14 @@ impl Add<isize> for isize {
#[lang = "sync"]
trait Sync {}
impl Sync for u8 {}
impl_marker_trait!(
Sync => [
char, bool,
isize, i8, i16, i32, i64, i128,
usize, u8, u16, u32, u64, u128,
f16, f32, f64, f128,
]
);
#[lang = "drop_in_place"]
fn drop_in_place<T>(_: *mut T) {}

View File

@@ -16,3 +16,12 @@ pub fn ref_of_local(f: fn(&i32)) {
let i = 0;
f(&i);
}
// CHECK-LABEL: @ref_of_global
// CHECK: addrspacecast (ptr addrspace(1) @I to ptr)
#[no_mangle]
pub fn ref_of_global(f: fn(&i32)) {
#[no_mangle]
static I: i32 = 0;
f(&I);
}