[llvm] [AMDGPU] Support lowering of cluster related instrinsics (PR #157978)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 11 08:51:16 PDT 2025


================
@@ -7415,6 +7552,22 @@ bool AMDGPULegalizerInfo::legalizeWaveID(MachineInstr &MI,
   return true;
 }
 
+bool AMDGPULegalizerInfo::legalizeConstHwRegRead(MachineInstr &MI,
+                                                 MachineIRBuilder &B,
+                                                 AMDGPU::Hwreg::Id HwReg,
+                                                 unsigned LowBit,
+                                                 unsigned Width) const {
+  MachineRegisterInfo &MRI = *B.getMRI();
+  Register DstReg = MI.getOperand(0).getReg();
+  if (!MRI.getRegClassOrNull(DstReg))
+    MRI.setRegClass(DstReg, &AMDGPU::SReg_32RegClass);
----------------
arsenm wrote:

Move this directly to selection then? Also use the normal constraint function. Having a class set previously doesn't necessarily mean it was the right one? 

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


More information about the llvm-commits mailing list