[llvm] f6b0c09 - [LiveDebugVariables] Use VirtRegMap::hasPhys. NFC (#106186)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 09:07:24 PDT 2024


Author: Craig Topper
Date: 2024-08-27T09:07:20-07:00
New Revision: f6b0c09214fd6805460689a36ed84489a8e89ef2

URL: https://github.com/llvm/llvm-project/commit/f6b0c09214fd6805460689a36ed84489a8e89ef2
DIFF: https://github.com/llvm/llvm-project/commit/f6b0c09214fd6805460689a36ed84489a8e89ef2.diff

LOG: [LiveDebugVariables] Use VirtRegMap::hasPhys. NFC (#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.

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveDebugVariables.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index d1341f116a5479..48bcc0a61e30c9 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -1529,8 +1529,7 @@ void UserValue::rewriteLocations(VirtRegMap &VRM, const MachineFunction &MF,
     // Only virtual registers are rewritten.
     if (Loc.isReg() && Loc.getReg() && Loc.getReg().isVirtual()) {
       Register VirtReg = Loc.getReg();
-      if (VRM.isAssignedReg(VirtReg) &&
-          Register::isPhysicalRegister(VRM.getPhys(VirtReg))) {
+      if (VRM.isAssignedReg(VirtReg) && VRM.hasPhys(VirtReg)) {
         // This can create a %noreg operand in rare cases when the sub-register
         // index is no longer available. That means the user value is in a
         // non-existent sub-register, and %noreg is exactly what we want.
@@ -1839,8 +1838,7 @@ void LDVImpl::emitDebugValues(VirtRegMap *VRM) {
     unsigned SubReg = It.second.SubReg;
 
     MachineBasicBlock *OrigMBB = Slots->getMBBFromIndex(Slot);
-    if (VRM->isAssignedReg(Reg) &&
-        Register::isPhysicalRegister(VRM->getPhys(Reg))) {
+    if (VRM->isAssignedReg(Reg) && VRM->hasPhys(Reg)) {
       unsigned PhysReg = VRM->getPhys(Reg);
       if (SubReg != 0)
         PhysReg = TRI->getSubReg(PhysReg, SubReg);


        


More information about the llvm-commits mailing list