[llvm] [RegisterCoalescer]: Try inflated RC for coalescing reg->subreg (PR #134438)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 4 22:55:35 PDT 2025


================
@@ -136,8 +136,16 @@ MachineRegisterInfo::recomputeRegClass(Register Reg) {
     unsigned OpNo = &MO - &MI->getOperand(0);
     NewRC = MI->getRegClassConstraintEffect(OpNo, NewRC, TII, TRI);
     if (!NewRC || NewRC == OldRC)
-      return false;
+      return OldRC;
   }
+  return NewRC;
+}
+
+bool MachineRegisterInfo::recomputeRegClass(Register Reg) {
+  const TargetRegisterClass *OldRC = getRegClass(Reg);
+  const TargetRegisterClass *NewRC = getLargestConstrainedSuperClass(Reg);
+  if (NewRC == OldRC)
+    return false;
----------------
arsenm wrote:

Is this return value actually useful anywhere? 

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


More information about the llvm-commits mailing list