OSDN Git Service

Process all dead defs after rematerializing during splitting.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 20 Mar 2011 19:46:23 +0000 (19:46 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 20 Mar 2011 19:46:23 +0000 (19:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127973 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SplitKit.cpp

index c0f4adf..b69a307 100644 (file)
@@ -789,30 +789,23 @@ void SplitEditor::rewriteAssigned(bool ExtendRanges) {
 
 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())