[llvm-branch-commits] [llvm-branch] r85604 - in /llvm/branches/Apple/Leela/lib/CodeGen: SimpleRegisterCoalescing.cpp SimpleRegisterCoalescing.h

Bill Wendling isanbard at gmail.com
Fri Oct 30 11:27:05 PDT 2009


Author: void
Date: Fri Oct 30 13:27:04 2009
New Revision: 85604

URL: http://llvm.org/viewvc/llvm-project?rev=85604&view=rev
Log:
$ svn merge -c 85338 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r85338 into '.':
U    lib/CodeGen/SimpleRegisterCoalescing.cpp
U    lib/CodeGen/SimpleRegisterCoalescing.h

$ svn merge -c 85599 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r85599 into '.':
G    lib/CodeGen/SimpleRegisterCoalescing.cpp
G    lib/CodeGen/SimpleRegisterCoalescing.h


Modified:
    llvm/branches/Apple/Leela/lib/CodeGen/SimpleRegisterCoalescing.cpp
    llvm/branches/Apple/Leela/lib/CodeGen/SimpleRegisterCoalescing.h

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

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Oct 30 13:27:04 2009
@@ -1861,6 +1861,23 @@
   return false;
 }
 
+
+/// ValueLiveAt - Return true if the LiveRange pointed to by the given
+/// iterator, or any subsequent range with the same value number,
+/// is live at the given point.
+bool SimpleRegisterCoalescing::ValueLiveAt(LiveInterval::iterator LRItr,
+                                           LiveInterval::iterator LREnd,
+                                           LiveIndex defPoint) const {
+  for (const VNInfo *valno = LRItr->valno;
+       (LRItr != LREnd) && (LRItr->valno == valno); ++LRItr) {
+    if (LRItr->contains(defPoint))
+      return true;
+  }
+
+  return false;
+}
+
+
 /// SimpleJoin - Attempt to joint the specified interval into this one. The
 /// caller of this method must guarantee that the RHS only contains a single
 /// value number and that the RHS is not defined by a copy from this
@@ -1907,7 +1924,7 @@
         if (!RangeIsDefinedByCopyFromReg(LHS, LHSIt, RHS.reg))
           return false;    // Nope, bail out.
 
-        if (LHSIt->contains(RHSIt->valno->def))
+        if (ValueLiveAt(LHSIt, LHS.end(), RHSIt->valno->def))
           // Here is an interesting situation:
           // BB1:
           //   vr1025 = copy vr1024
@@ -1945,7 +1962,7 @@
           // Otherwise, if this is a copy from the RHS, mark it as being merged
           // in.
           if (RangeIsDefinedByCopyFromReg(LHS, LHSIt, RHS.reg)) {
-            if (LHSIt->contains(RHSIt->valno->def))
+            if (ValueLiveAt(LHSIt, LHS.end(), RHSIt->valno->def))
               // Here is an interesting situation:
               // BB1:
               //   vr1025 = copy vr1024

Modified: llvm/branches/Apple/Leela/lib/CodeGen/SimpleRegisterCoalescing.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/SimpleRegisterCoalescing.h?rev=85604&r1=85603&r2=85604&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/SimpleRegisterCoalescing.h (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/SimpleRegisterCoalescing.h Fri Oct 30 13:27:04 2009
@@ -201,6 +201,12 @@
     bool CanJoinInsertSubRegToPhysReg(unsigned DstReg, unsigned SrcReg,
                                       unsigned SubIdx, unsigned &RealDstReg);
 
+    /// ValueLiveAt - Return true if the LiveRange pointed to by the given
+    /// iterator, or any subsequent range with the same value number,
+    /// is live at the given point.
+    bool ValueLiveAt(LiveInterval::iterator LRItr, LiveInterval::iterator LREnd, 
+                     LiveIndex defPoint) const;                                  
+
     /// RangeIsDefinedByCopyFromReg - Return true if the specified live range of
     /// the specified live interval is defined by a copy from the specified
     /// register.





More information about the llvm-branch-commits mailing list