[llvm] [AArch64][GlobalISel] Constrain G_CONSTANT_FOLD_BARRIER operand register classes (PR #177997)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 30 00:10:00 PST 2026


davemgreen wrote:

> As far as I can tell looking at https://llvm.org/doxygen/MachineRegisterInfo_8cpp_source.html#l00069 MRI.setRegClass(SrcReg, DstRC) and MRI.constrainRegClass(SrcReg, DstRC) are equivalent? I.e. gpr64 is the common subclass of gpr64sp/gpr64 which is equivalent to MRI.setRegClass(SrcReg, DstRC)

constrainRegClass should call getCommonSubClass. The common subclass of gpr64 and gpr64sp is gpr64common IIRC.

> I did try your suggestion and canReplaceReg assert fired and when I checked for that and bailed it still crashed.

I think that just doesn't handle where both regs already have reg classes. I think we can just remove the assert.

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


More information about the llvm-commits mailing list