[llvm-commits] [llvm] r61460 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp

Owen Anderson resistor at mac.com
Sun Dec 28 15:35:14 PST 2008


Author: resistor
Date: Sun Dec 28 17:35:13 2008
New Revision: 61460

URL: http://llvm.org/viewvc/llvm-project?rev=61460&view=rev
Log:
Fix up kill/dead marking in the new live interval reconstruction code.

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

Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=61460&r1=61459&r2=61460&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original)
+++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Sun Dec 28 17:35:13 2008
@@ -722,10 +722,9 @@
                                  NewVNs, Visited, false);
     
     // FIXME: Need to set kills properly for inter-block stuff.
-    if (toplevel) {
-      if (LI->isKill(ret, UseIndex)) LI->removeKill(ret, UseIndex);
+    if (LI->isKill(ret, UseIndex)) LI->removeKill(ret, UseIndex);
+    if (toplevel)
       LI->addKill(ret, EndIndex);
-    }
     
     LI->addRange(LiveRange(UseIndex, EndIndex, ret));
   } else if (ContainsDefs && ContainsUses){
@@ -778,10 +777,9 @@
       ret = PerformPHIConstruction(walker, LI, Defs, Uses,
                                    NewVNs, Visited, false);
 
-    // FIXME: Need to set kills properly for inter-block stuff.
+    if (foundUse && LI->isKill(ret, StartIndex))
+      LI->removeKill(ret, StartIndex);
     if (toplevel) {
-      if (foundUse && LI->isKill(ret, StartIndex))
-        LI->removeKill(ret, StartIndex);
       LI->addKill(ret, EndIndex);
     }
 
@@ -834,6 +832,20 @@
     DenseMap<MachineBasicBlock*, VNInfo*> Visited;
     PerformPHIConstruction(&*UI, LI, Defs, Uses, NewVNs, Visited, true); 
   }
+  
+  // Add ranges for dead defs
+  for (MachineRegisterInfo::def_iterator DI = MRI->def_begin(LI->reg),
+       DE = MRI->def_end(); DI != DE; ++DI) {
+    unsigned DefIdx = LIs->getInstructionIndex(&*DI);
+    DefIdx = LiveIntervals::getDefIndex(DefIdx);
+    unsigned UseIdx = LiveIntervals::getUseIndex(DefIdx);
+    
+    if (LI->liveAt(DefIdx)) continue;
+    
+    VNInfo* DeadVN = NewVNs[&*DI];
+    LI->addRange(LiveRange(DefIdx, UseIdx, DeadVN));
+    LI->addKill(DeadVN, DefIdx);
+  }
 }
 
 /// ShrinkWrapLiveInterval - Recursively traverse the predecessor





More information about the llvm-commits mailing list