llvm / llvm/llvm-project

clang ABI lowering should not turn FP + int structs into integer arrays for AMDGPU

Open
#184,150 5 comments 0 reactions 0 assignees View on GitHub
backend:AMDGPU clang:codegen
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Clang chooses to represent a struct containing a float and an int as an integer array: https://godbolt.org/z/sjafTqbq3

```c++
// clang -target amdgcn-amd-amdhsa -S -emit-llvm -o - -nogpulib -nogpuinc %s

typedef struct fp_int_pair {
float f;
int i;
} fp_int_pair;

fp_int_pair foo(fp_int_pair x) {
return x;
}

// Should emit { float, i32 }

//define hidden [2 x i32] @foo([2 x i32] returned %x.coerce) local_unnamed_addr #0 {
//entry:
// ret [2 x i32] %x.coerce
//}
```

There's no benefit to turning this into an integer array. If we had proper multiple return values, we would need this represented as the two types to attach nofpclass to the float component.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.