diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 98bc8a1c69fd..0f58e617b3e9 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -990,7 +990,7 @@ bool MIParser::parseRegisterOperand(MachineOperand &Dest, // Virtual registers may have a size with GlobalISel. if (!TargetRegisterInfo::isVirtualRegister(Reg)) return error("unexpected size on physical register"); - if (MRI.getRegClassOrRegBank(Reg).is()) + if (RegInfo->Kind != VRegInfo::GENERIC) return error("unexpected size on non-generic virtual register"); LLT Ty; diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp index 5b42cd01efcf..96a5888b3705 100644 --- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp +++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp @@ -124,7 +124,8 @@ LLT MachineRegisterInfo::getType(unsigned VReg) const { void MachineRegisterInfo::setType(unsigned VReg, LLT Ty) { // Check that VReg doesn't have a class. - assert(!getRegClassOrRegBank(VReg).is() && + assert(getRegClassOrRegBank(VReg).isNull() || + !getRegClassOrRegBank(VReg).is() && "Can't set the size of a non-generic virtual register"); getVRegToType()[VReg] = Ty; }