Skip to content

Commit f6b0c09

Browse files
authored
[LiveDebugVariables] Use VirtRegMap::hasPhys. NFC (llvm#106186)
Use hasPhys instead of MCRegister::isPhysicalRegister. I think the MCRegister returned from getPhys can only contain a physical register or 0. hasPhys checks that the register returned from getPhys is non-zero. So I think they are equivalent in this usage.
1 parent d58bd21 commit f6b0c09

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/CodeGen/LiveDebugVariables.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,8 +1529,7 @@ void UserValue::rewriteLocations(VirtRegMap &VRM, const MachineFunction &MF,
15291529
// Only virtual registers are rewritten.
15301530
if (Loc.isReg() && Loc.getReg() && Loc.getReg().isVirtual()) {
15311531
Register VirtReg = Loc.getReg();
1532-
if (VRM.isAssignedReg(VirtReg) &&
1533-
Register::isPhysicalRegister(VRM.getPhys(VirtReg))) {
1532+
if (VRM.isAssignedReg(VirtReg) && VRM.hasPhys(VirtReg)) {
15341533
// This can create a %noreg operand in rare cases when the sub-register
15351534
// index is no longer available. That means the user value is in a
15361535
// non-existent sub-register, and %noreg is exactly what we want.
@@ -1839,8 +1838,7 @@ void LDVImpl::emitDebugValues(VirtRegMap *VRM) {
18391838
unsigned SubReg = It.second.SubReg;
18401839

18411840
MachineBasicBlock *OrigMBB = Slots->getMBBFromIndex(Slot);
1842-
if (VRM->isAssignedReg(Reg) &&
1843-
Register::isPhysicalRegister(VRM->getPhys(Reg))) {
1841+
if (VRM->isAssignedReg(Reg) && VRM->hasPhys(Reg)) {
18441842
unsigned PhysReg = VRM->getPhys(Reg);
18451843
if (SubReg != 0)
18461844
PhysReg = TRI->getSubReg(PhysReg, SubReg);

0 commit comments

Comments
 (0)