https://github.com/addmisol created https://github.com/llvm/llvm-project/pull/195875
Removing unnecessary comments as suggested cc @jayfoad >From c5ffb2e73bcf69513f94d8e7b89e8372d0d280b2 Mon Sep 17 00:00:00 2001 From: addmisol <[email protected]> Date: Fri, 6 Mar 2026 23:56:34 +0530 Subject: [PATCH 1/3] Create amdgpu-abi-struct-coerce.c --- .../test/CodeGen/amdgpu-abi-struct-coerce.c | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 clang/test/CodeGen/clang/test/CodeGen/amdgpu-abi-struct-coerce.c diff --git a/clang/test/CodeGen/clang/test/CodeGen/amdgpu-abi-struct-coerce.c b/clang/test/CodeGen/clang/test/CodeGen/amdgpu-abi-struct-coerce.c new file mode 100644 index 0000000000000..2399630ff797b --- /dev/null +++ b/clang/test/CodeGen/clang/test/CodeGen/amdgpu-abi-struct-coerce.c @@ -0,0 +1,71 @@ +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -emit-llvm -o - %s | FileCheck %s + +// Check that structs containing mixed float and int types are not coerced +// to integer arrays. They should preserve the original struct type and +// individual field types. + +typedef struct fp_int_pair { + float f; + int i; +} fp_int_pair; + +// CHECK-LABEL: define{{.*}} %struct.fp_int_pair @return_fp_int_pair(float %x.coerce0, i32 %x.coerce1) +// CHECK: ret %struct.fp_int_pair +fp_int_pair return_fp_int_pair(fp_int_pair x) { + return x; +} + +typedef struct int_fp_pair { + int i; + float f; +} int_fp_pair; + +// CHECK-LABEL: define{{.*}} %struct.int_fp_pair @return_int_fp_pair(i32 %x.coerce0, float %x.coerce1) +// CHECK: ret %struct.int_fp_pair +int_fp_pair return_int_fp_pair(int_fp_pair x) { + return x; +} + +typedef struct two_floats { + float a; + float b; +} two_floats; + +// CHECK-LABEL: define{{.*}} %struct.two_floats @return_two_floats(float %x.coerce0, float %x.coerce1) +// CHECK: ret %struct.two_floats +two_floats return_two_floats(two_floats x) { + return x; +} + +typedef struct two_ints { + int a; + int b; +} two_ints; + +// CHECK-LABEL: define{{.*}} %struct.two_ints @return_two_ints(i32 %x.coerce0, i32 %x.coerce1) +// CHECK: ret %struct.two_ints +two_ints return_two_ints(two_ints x) { + return x; +} + +// Structs <= 32 bits should still be coerced to i32 for return value +typedef struct small_struct { + short a; + short b; +} small_struct; + +// CHECK-LABEL: define{{.*}} i32 @return_small_struct(i16 %x.coerce0, i16 %x.coerce1) +small_struct return_small_struct(small_struct x) { + return x; +} + +// Structs <= 16 bits should still be coerced to i16 for return value +typedef struct tiny_struct { + char a; + char b; +} tiny_struct; + +// CHECK-LABEL: define{{.*}} i16 @return_tiny_struct(i8 %x.coerce0, i8 %x.coerce1) +tiny_struct return_tiny_struct(tiny_struct x) { + return x; +} >From 68c200f848058ab22b3d25ce810f1639eac50556 Mon Sep 17 00:00:00 2001 From: addmisol <[email protected]> Date: Fri, 6 Mar 2026 23:57:11 +0530 Subject: [PATCH 2/3] Delete clang/test/CodeGen/clang/test/CodeGen/amdgpu-abi-struct-coerce.c --- .../test/CodeGen/amdgpu-abi-struct-coerce.c | 71 ------------------- 1 file changed, 71 deletions(-) delete mode 100644 clang/test/CodeGen/clang/test/CodeGen/amdgpu-abi-struct-coerce.c diff --git a/clang/test/CodeGen/clang/test/CodeGen/amdgpu-abi-struct-coerce.c b/clang/test/CodeGen/clang/test/CodeGen/amdgpu-abi-struct-coerce.c deleted file mode 100644 index 2399630ff797b..0000000000000 --- a/clang/test/CodeGen/clang/test/CodeGen/amdgpu-abi-struct-coerce.c +++ /dev/null @@ -1,71 +0,0 @@ -// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -emit-llvm -o - %s | FileCheck %s - -// Check that structs containing mixed float and int types are not coerced -// to integer arrays. They should preserve the original struct type and -// individual field types. - -typedef struct fp_int_pair { - float f; - int i; -} fp_int_pair; - -// CHECK-LABEL: define{{.*}} %struct.fp_int_pair @return_fp_int_pair(float %x.coerce0, i32 %x.coerce1) -// CHECK: ret %struct.fp_int_pair -fp_int_pair return_fp_int_pair(fp_int_pair x) { - return x; -} - -typedef struct int_fp_pair { - int i; - float f; -} int_fp_pair; - -// CHECK-LABEL: define{{.*}} %struct.int_fp_pair @return_int_fp_pair(i32 %x.coerce0, float %x.coerce1) -// CHECK: ret %struct.int_fp_pair -int_fp_pair return_int_fp_pair(int_fp_pair x) { - return x; -} - -typedef struct two_floats { - float a; - float b; -} two_floats; - -// CHECK-LABEL: define{{.*}} %struct.two_floats @return_two_floats(float %x.coerce0, float %x.coerce1) -// CHECK: ret %struct.two_floats -two_floats return_two_floats(two_floats x) { - return x; -} - -typedef struct two_ints { - int a; - int b; -} two_ints; - -// CHECK-LABEL: define{{.*}} %struct.two_ints @return_two_ints(i32 %x.coerce0, i32 %x.coerce1) -// CHECK: ret %struct.two_ints -two_ints return_two_ints(two_ints x) { - return x; -} - -// Structs <= 32 bits should still be coerced to i32 for return value -typedef struct small_struct { - short a; - short b; -} small_struct; - -// CHECK-LABEL: define{{.*}} i32 @return_small_struct(i16 %x.coerce0, i16 %x.coerce1) -small_struct return_small_struct(small_struct x) { - return x; -} - -// Structs <= 16 bits should still be coerced to i16 for return value -typedef struct tiny_struct { - char a; - char b; -} tiny_struct; - -// CHECK-LABEL: define{{.*}} i16 @return_tiny_struct(i8 %x.coerce0, i8 %x.coerce1) -tiny_struct return_tiny_struct(tiny_struct x) { - return x; -} >From f4d0771589dbcd956643f67d8fec8fbeb587d7b6 Mon Sep 17 00:00:00 2001 From: Addmisol <[email protected]> Date: Tue, 5 May 2026 21:17:23 +0530 Subject: [PATCH 3/3] Update int2ptr.ll --- llvm/test/Transforms/InferAddressSpaces/AMDGPU/int2ptr.ll | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/int2ptr.ll b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/int2ptr.ll index 6b6d8162b6e7b..a0e409fe82e84 100644 --- a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/int2ptr.ll +++ b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/int2ptr.ll @@ -47,7 +47,7 @@ define void @test_xor_local_max32bit(ptr addrspace(3) %sp) { ret void } -; 0x100000000 tests bit 32 (0-indexed), not bit 33 +; 0x100000000 tests bit 32 (0-indexed) define void @test_xor_local_fail_bit32(ptr addrspace(3) %sp) { ; CHECK-LABEL: define void @test_xor_local_fail_bit32( ; CHECK-SAME: ptr addrspace(3) [[SP:%.*]]) { @@ -166,7 +166,7 @@ define void @test_xor_global_max32bit(ptr addrspace(1) %sp) { ; are bit-identical in both global and flat address spaces. Global memory regions ; are architecturally separate from the private/local aperture regions, which use ; specific high-address ranges that don't overlap with valid global addresses. -; 0x100000000 tests bit 32 (0-indexed), not bit 33 +; 0x100000000 tests bit 32 (0-indexed) define void @test_xor_global_bit32(ptr addrspace(1) %sp) { ; CHECK-LABEL: define void @test_xor_global_bit32( ; CHECK-SAME: ptr addrspace(1) [[SP:%.*]]) { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
