[llvm-commits] [llvm] r127973 - /llvm/trunk/lib/CodeGen/SplitKit.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Sun Mar 20 12:46:24 PDT 2011


Author: stoklund
Date: Sun Mar 20 14:46:23 2011
New Revision: 127973

URL: http://llvm.org/viewvc/llvm-project?rev=127973&view=rev
Log:
Process all dead defs after rematerializing during splitting.

Modified:
    llvm/trunk/lib/CodeGen/SplitKit.cpp

Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=127973&r1=127972&r2=127973&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Sun Mar 20 14:46:23 2011
@@ -789,30 +789,23 @@
 
 void SplitEditor::deleteRematVictims() {
   SmallVector<MachineInstr*, 8> Dead;
-  for (LiveInterval::const_vni_iterator I = Edit->getParent().vni_begin(),
-         E = Edit->getParent().vni_end(); I != E; ++I) {
-    const VNInfo *VNI = *I;
-    // Was VNI rematted anywhere?
-    if (VNI->isUnused() || VNI->isPHIDef() || !Edit->didRematerialize(VNI))
-      continue;
-    unsigned RegIdx = RegAssign.lookup(VNI->def);
-    LiveInterval *LI = Edit->get(RegIdx);
-    LiveInterval::const_iterator LII = LI->FindLiveRangeContaining(VNI->def);
-    assert(LII != LI->end() && "Missing live range for rematted def");
-
-    // Is this a dead def?
-    if (LII->end != VNI->def.getNextSlot())
-      continue;
-
-    MachineInstr *MI = LIS.getInstructionFromIndex(VNI->def);
-    assert(MI && "Missing instruction for dead def");
-    MI->addRegisterDead(LI->reg, &TRI);
+  for (LiveRangeEdit::iterator I = Edit->begin(), E = Edit->end(); I != E; ++I){
+    LiveInterval *LI = *I;
+    for (LiveInterval::const_iterator LII = LI->begin(), LIE = LI->end();
+           LII != LIE; ++LII) {
+      // Dead defs end at the store slot.
+      if (LII->end != LII->valno->def.getNextSlot())
+        continue;
+      MachineInstr *MI = LIS.getInstructionFromIndex(LII->valno->def);
+      assert(MI && "Missing instruction for dead def");
+      MI->addRegisterDead(LI->reg, &TRI);
 
-    if (!MI->allDefsAreDead())
-      continue;
+      if (!MI->allDefsAreDead())
+        continue;
 
-    DEBUG(dbgs() << "All defs dead: " << *MI);
-    Dead.push_back(MI);
+      DEBUG(dbgs() << "All defs dead: " << *MI);
+      Dead.push_back(MI);
+    }
   }
 
   if (Dead.empty())





More information about the llvm-commits mailing list