[llvm] [AMDGPU][MC] Disallow null as saddr in flat instructions (PR #101730)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 11:42:44 PDT 2024


================
@@ -6048,10 +6048,14 @@ void SIInstrInfo::legalizeOperandsVOP3(MachineRegisterInfo &MRI,
     legalizeOpWithMove(MI, VOP3Idx[2]);
 }
 
-Register SIInstrInfo::readlaneVGPRToSGPR(Register SrcReg, MachineInstr &UseMI,
-                                         MachineRegisterInfo &MRI) const {
+Register SIInstrInfo::readlaneVGPRToSGPR(
+    Register SrcReg, MachineInstr &UseMI, MachineRegisterInfo &MRI,
+    const TargetRegisterClass *DstRC /*=nullptr*/) const {
   const TargetRegisterClass *VRC = MRI.getRegClass(SrcReg);
   const TargetRegisterClass *SRC = RI.getEquivalentSGPRClass(VRC);
+  if (DstRC)
+    SRC = ST.getRegisterInfo()->getCommonSubClass(SRC, DstRC);
----------------
arsenm wrote:

```suggestion
    SRC = RI.getCommonSubClass(SRC, DstRC);
```

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


More information about the llvm-commits mailing list