[llvm] 46f7cb3 - [CodeGen] Use Register::id() instead of implicit cast to unsigned in Register.h. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 15 19:02:22 PDT 2024


Author: Craig Topper
Date: 2024-09-15T19:01:38-07:00
New Revision: 46f7cb3e84c2089db3e698cfd894167006433090

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

LOG: [CodeGen] Use Register::id() instead of implicit cast to unsigned in Register.h. NFC

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/Register.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/Register.h b/llvm/include/llvm/CodeGen/Register.h
index 0ad576fec7d8de..c93b8e10a17574 100644
--- a/llvm/include/llvm/CodeGen/Register.h
+++ b/llvm/include/llvm/CodeGen/Register.h
@@ -51,7 +51,7 @@ class Register {
   /// Compute the frame index from a register value representing a stack slot.
   static int stackSlot2Index(Register Reg) {
     assert(Reg.isStack() && "Not a stack slot");
-    return int(Reg - MCRegister::FirstStackSlot);
+    return int(Reg.id() - MCRegister::FirstStackSlot);
   }
 
   /// Convert a non-negative frame index to a stack slot register value.
@@ -76,7 +76,7 @@ class Register {
   /// The first virtual register in a function will get the index 0.
   static unsigned virtReg2Index(Register Reg) {
     assert(Reg.isVirtual() && "Not a virtual register");
-    return Reg & ~MCRegister::VirtualRegFlag;
+    return Reg.id() & ~MCRegister::VirtualRegFlag;
   }
 
   /// Convert a 0-based index to a virtual register number.


        


More information about the llvm-commits mailing list