[llvm] r367932 - Revert Register/MCRegister: Add conversion operators to avoid use of implicit convert to unsigned. NFC

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 14:34:45 PDT 2019


Author: dsanders
Date: Mon Aug  5 14:34:45 2019
New Revision: 367932

URL: http://llvm.org/viewvc/llvm-project?rev=367932&view=rev
Log:
Revert Register/MCRegister: Add conversion operators to avoid use of implicit convert to unsigned. NFC

MSVC finds ambiguity where clang doesn't and it looks like it's not going to be an easy fix
Reverting while I figure out how to fix it

This reverts r367916 (git commit aa15ec3c231717826e3c262b5ef9813d2fb5cadb)
This reverts r367920 (git commit 5d14efe279b5db9f4746ff834ab5c70e249d3871)

Modified:
    llvm/trunk/include/llvm/CodeGen/Register.h
    llvm/trunk/include/llvm/MC/MCRegister.h
    llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp

Modified: llvm/trunk/include/llvm/CodeGen/Register.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Register.h?rev=367932&r1=367931&r2=367932&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/Register.h (original)
+++ llvm/trunk/include/llvm/CodeGen/Register.h Mon Aug  5 14:34:45 2019
@@ -113,19 +113,6 @@ public:
   bool isValid() const {
     return Reg != 0;
   }
-
-  /// Comparisons between register objects
-  bool operator==(const Register &Other) const { return Reg == Other.Reg; }
-  bool operator!=(const Register &Other) const { return Reg != Other.Reg; }
-
-  /// Comparisons against register constants. E.g.
-  /// * R == AArch64::WZR
-  /// * R == 0
-  /// * R == VirtRegMap::NO_PHYS_REG
-  bool operator==(unsigned Other) const { return Reg == Other; }
-  bool operator!=(unsigned Other) const { return Reg != Other; }
-  bool operator==(int Other) const { return Reg == unsigned(Other); }
-  bool operator!=(int Other) const { return Reg != unsigned(Other); }
 };
 
 // Provide DenseMapInfo for Register

Modified: llvm/trunk/include/llvm/MC/MCRegister.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCRegister.h?rev=367932&r1=367931&r2=367932&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCRegister.h (original)
+++ llvm/trunk/include/llvm/MC/MCRegister.h Mon Aug  5 14:34:45 2019
@@ -63,19 +63,6 @@ public:
   bool isValid() const {
     return Reg != 0;
   }
-
-  /// Comparisons between register objects
-  bool operator==(const MCRegister &Other) const { return Reg == Other.Reg; }
-  bool operator!=(const MCRegister &Other) const { return Reg != Other.Reg; }
-
-  /// Comparisons against register constants. E.g.
-  /// * R == AArch64::WZR
-  /// * R == 0
-  /// * R == VirtRegMap::NO_PHYS_REG
-  bool operator==(unsigned Other) const { return Reg == Other; }
-  bool operator!=(unsigned Other) const { return Reg != Other; }
-  bool operator==(int Other) const { return Reg == unsigned(Other); }
-  bool operator!=(int Other) const { return Reg != unsigned(Other); }
 };
 
 // Provide DenseMapInfo for MCRegister

Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=367932&r1=367931&r2=367932&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Mon Aug  5 14:34:45 2019
@@ -499,7 +499,7 @@ MachineBasicBlock::addLiveIn(MCPhysReg P
   // Look for an existing copy.
   if (LiveIn)
     for (;I != E && I->isCopy(); ++I)
-      if (I->getOperand(1).getReg() == Register(PhysReg)) {
+      if (I->getOperand(1).getReg() == PhysReg) {
         unsigned VirtReg = I->getOperand(0).getReg();
         if (!MRI.constrainRegClass(VirtReg, RC))
           llvm_unreachable("Incompatible live-in register class.");




More information about the llvm-commits mailing list