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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 02:11:12 PDT 2024


================
@@ -3225,6 +3230,21 @@ SDValue SITargetLowering::LowerCallResult(
       Val = DAG.getCopyFromReg(Chain, DL, VA.getLocReg(), VA.getLocVT(), InGlue);
       Chain = Val.getValue(1);
       InGlue = Val.getValue(2);
+
+      // For i1 return value allocated to an SGPR, we want the dst reg for the
+      // above CopyFromReg not to be of VReg_1 when emitting machine code.
+      // This requires creating an addional CopyToReg followed by another
+      // CopyFromReg.
+      if (RVLocs.size() == 1 && VA.getLocVT() == MVT::i1) {
+        const SIRegisterInfo *TRI = Subtarget->getRegisterInfo();
+        MachineRegisterInfo &MRI = DAG.getMachineFunction().getRegInfo();
+
+        if (TRI->isSGPRReg(MRI, VA.getLocReg())) {
----------------
arsenm wrote:

This should always be true if LocVT is i1 

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


More information about the llvm-commits mailing list