[llvm-commits] [llvm] r64077 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/LiveInterval.h lib/CodeGen/SimpleRegisterCoalescing.cpp

Bill Wendling isanbard at gmail.com
Sun Feb 8 00:35:25 PST 2009


Author: void
Date: Sun Feb  8 02:35:25 2009
New Revision: 64077

URL: http://llvm.org/viewvc/llvm-project?rev=64077&view=rev
Log:
Pull r64073 r64075 and r64076 into Dib.

Modified:
    llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h
    llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp

Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h?rev=64077&r1=64076&r2=64077&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/LiveInterval.h Sun Feb  8 02:35:25 2009
@@ -271,6 +271,17 @@
         I = std::lower_bound(kills.begin(), kills.end(), KillIdx);
       return I != kills.end() && *I == KillIdx;
     }
+
+    /// isOnlyLROfValNo - Return true if the specified live range is the only
+    /// one defined by the its val#.
+    bool isOnlyLROfValNo( const LiveRange *LR) {
+      for (const_iterator I = begin(), E = end(); I != E; ++I) {
+        const LiveRange *Tmp = I;
+        if (Tmp != LR && Tmp->valno == LR->valno)
+          return false;
+      }
+      return true;
+    }
     
     /// MergeValueNumberInto - This method is called when two value nubmers
     /// are found to be equivalent.  This eliminates V1, replacing all

Modified: llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=64077&r1=64076&r2=64077&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp Sun Feb  8 02:35:25 2009
@@ -42,6 +42,7 @@
 STATISTIC(NumReMats   , "Number of instructions re-materialized");
 STATISTIC(numPeep     , "Number of identity moves eliminated after coalescing");
 STATISTIC(numAborts   , "Number of times interval joining aborted");
+STATISTIC(numDeadValNo, "Number of valno def marked dead");
 
 char SimpleRegisterCoalescing::ID = 0;
 static cl::opt<bool>
@@ -488,7 +489,7 @@
 }
 
 /// TrimLiveIntervalToLastUse - If there is a last use in the same basic block
-/// as the copy instruction, trim the ive interval to the last use and return
+/// as the copy instruction, trim the live interval to the last use and return
 /// true.
 bool
 SimpleRegisterCoalescing::TrimLiveIntervalToLastUse(unsigned CopyIdx,
@@ -863,9 +864,17 @@
   if (TrimLiveIntervalToLastUse(CopyIdx, CopyMI->getParent(), li, LR))
     return false;
 
-  if (LR->valno->def == RemoveStart)
-    // If the def MI defines the val#, propagate the dead marker.
-    PropagateDeadness(li, CopyMI, RemoveStart, li_, tri_);
+  if (LR->valno->def == RemoveStart) {
+    // If the def MI defines the val# and this copy is the only kill of the
+    // val#, then propagate the dead marker.
+    if (!li.isOnlyLROfValNo(LR)) {
+      if (li.isKill(LR->valno, RemoveEnd))
+        li.removeKill(LR->valno, RemoveEnd);
+    } else {
+      PropagateDeadness(li, CopyMI, RemoveStart, li_, tri_);
+      ++numDeadValNo;
+    }
+  }
 
   removeRange(li, RemoveStart, LR->end, li_, tri_);
   return removeIntervalIfEmpty(li, li_, tri_);





More information about the llvm-commits mailing list