[llvm] r184572 - Handle more cases in LiveRangeEdit::eliminateDeadDefs.

Andrew Trick atrick at apple.com
Fri Jun 21 11:33:20 PDT 2013


Author: atrick
Date: Fri Jun 21 13:33:20 2013
New Revision: 184572

URL: http://llvm.org/viewvc/llvm-project?rev=184572&view=rev
Log:
Handle more cases in LiveRangeEdit::eliminateDeadDefs.

Live intervals for dead physregs may be created during coalescing. We
need to update these in the event that their instruction goes away.

crash.ll is the unit test that catches it when MI sched is enabled on
X86.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h
    llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp

Modified: llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h?rev=184572&r1=184571&r2=184572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Fri Jun 21 13:33:20 2013
@@ -58,10 +58,6 @@ class MachineRegisterInfo {
   /// physical registers.
   MachineOperand **PhysRegUseDefLists;
 
-  const TargetRegisterInfo *getTargetRegisterInfo() const {
-    return TM.getRegisterInfo();
-  }
-
   /// getRegUseDefListHead - Return the head pointer for the register use/def
   /// list for the specified virtual or physical register.
   MachineOperand *&getRegUseDefListHead(unsigned RegNo) {
@@ -116,6 +112,10 @@ public:
   explicit MachineRegisterInfo(const TargetMachine &TM);
   ~MachineRegisterInfo();
 
+  const TargetRegisterInfo *getTargetRegisterInfo() const {
+    return TM.getRegisterInfo();
+  }
+
   //===--------------------------------------------------------------------===//
   // Function State
   //===--------------------------------------------------------------------===//

Modified: llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp?rev=184572&r1=184571&r2=184572&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveRangeEdit.cpp Fri Jun 21 13:33:20 2013
@@ -249,6 +249,15 @@ void LiveRangeEdit::eliminateDeadDef(Mac
       // Check if MI reads any unreserved physregs.
       if (Reg && MOI->readsReg() && !MRI.isReserved(Reg))
         ReadsPhysRegs = true;
+      else if (MOI->isDef()) {
+        for (MCRegUnitIterator Units(Reg, MRI.getTargetRegisterInfo());
+             Units.isValid(); ++Units) {
+          if (LiveInterval *LI = LIS.getCachedRegUnit(*Units)) {
+            if (VNInfo *VNI = LI->getVNInfoAt(Idx))
+              LI->removeValNo(VNI);
+          }
+        }
+      }
       continue;
     }
     LiveInterval &LI = LIS.getInterval(Reg);





More information about the llvm-commits mailing list