From 485bdafdcfb340e74b7342d716b2135d4c6c8ca1 Mon Sep 17 00:00:00 2001 From: Flakebi Date: Wed, 3 Sep 2025 08:29:52 +0200 Subject: 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. --- tests/codegen-llvm/amdgpu-addrspacecast.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/codegen-llvm') diff --git a/tests/codegen-llvm/amdgpu-addrspacecast.rs b/tests/codegen-llvm/amdgpu-addrspacecast.rs index 7fe630a7efa..829133de00d 100644 --- a/tests/codegen-llvm/amdgpu-addrspacecast.rs +++ b/tests/codegen-llvm/amdgpu-addrspacecast.rs @@ -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); +} -- cgit 1.4.1-3-g733a5