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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 05:09:50 PDT 2024


================
@@ -6205,6 +6205,12 @@ void SIInstrInfo::legalizeOperandsFLAT(MachineRegisterInfo &MRI,
     return;
 
   Register ToSGPR = readlaneVGPRToSGPR(SAddr->getReg(), MI, MRI);
+
+  const TargetRegisterClass *DeclaredRC =
+      getRegClass(MI.getDesc(), SAddr->getOperandNo(),
+                  MRI.getTargetRegisterInfo(), *MI.getParent()->getParent());
+
+  MRI.setRegClass(ToSGPR, DeclaredRC);
----------------
arsenm wrote:

Something like this, (but you can just use RI directly as a member of SIInstrInfo)

Also it's easier to review changes when you post them as real revisions 

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


More information about the llvm-commits mailing list