[llvm] [AMDGPU] Allocate i1 argument to SGPRs (PR #72461)

Jun Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 15:12:14 PST 2024


================
@@ -185,9 +185,12 @@ def CSR_AMDGPU_NoRegs : CalleeSavedRegs<(add)>;
 // Calling convention for leaf functions
 def CC_AMDGPU_Func : CallingConv<[
   CCIfByVal<CCPassByVal<4, 4>>,
-  CCIfType<[i1], CCPromoteToType<i32>>,
   CCIfType<[i8, i16], CCIfExtend<CCPromoteToType<i32>>>,
 
+  CCIfType<[i1] , CCCustom<"CC_AMDGPU_Custom_I1">>,
+
+  CCIfType<[i1], CCPromoteToType<i32>>,
----------------
jwanggit86 wrote:

When CC_AMDGPU_Custom_I1 fails, i.e., an i1 arg is not allocated to an SGPR. If the i1 is not promoted to i32, we end up with a COPY from a 32b VGPR to a 64b VGPR, which is rejected by SIInstrInfo::copyPhysReg():

```
renamable $vgpr0_vgpr1 = COPY killed renamable $vgpr0, implicit $exec
```

https://github.com/llvm/llvm-project/pull/72461


More information about the llvm-commits mailing list