Instead of searching for a live interval pair, search for a location. This gives
authorChris Lattner <sabre@nondot.org>
Fri, 23 Jul 2004 18:13:24 +0000 (18:13 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 23 Jul 2004 18:13:24 +0000 (18:13 +0000)
a very modest speedup of .3 seconds compiling 176.gcc (out of 20s).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15136 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/LiveInterval.h
lib/CodeGen/LiveInterval.cpp
lib/CodeGen/LiveInterval.h

index 33bc036b66d1738fe3787c1a445e4e587c5ba580..d25f7e31a340135f71fd21ecfbb53c3b65e6cc56 100644 (file)
@@ -47,6 +47,11 @@ namespace llvm {
   };
   std::ostream& operator<<(std::ostream& os, const LiveRange &LR);
 
+  inline bool operator<(unsigned V, const LiveRange &LR) {
+    return V < LR.start;
+  }
+
+
   /// LiveInterval - This class represents some number of live ranges for a
   /// register or value.  This class also contains a bit of register allocator
   /// state.
index 5954b59f15077c6734dd54866db9830cfe94cf44..b0189daf83e55ae845dd9133ea860479c7b610af 100644 (file)
@@ -30,16 +30,14 @@ using namespace llvm;
 // definition of the variable it represents. This is because slot 1 is
 // used (def slot) and spans up to slot 3 (store slot).
 //
-bool LiveInterval::liveAt(unsigned index) const {
-  LiveRange dummy(index, index+1);
-  Ranges::const_iterator r = std::upper_bound(ranges.begin(),
-                                              ranges.end(),
-                                              dummy);
+bool LiveInterval::liveAt(unsigned I) const {
+  Ranges::const_iterator r = std::upper_bound(ranges.begin(), ranges.end(), I);
+                                              
   if (r == ranges.begin())
     return false;
 
   --r;
-  return index >= r->start && index < r->end;
+  return I >= r->start && I < r->end;
 }
 
 // An example for overlaps():
index 33bc036b66d1738fe3787c1a445e4e587c5ba580..d25f7e31a340135f71fd21ecfbb53c3b65e6cc56 100644 (file)
@@ -47,6 +47,11 @@ namespace llvm {
   };
   std::ostream& operator<<(std::ostream& os, const LiveRange &LR);
 
+  inline bool operator<(unsigned V, const LiveRange &LR) {
+    return V < LR.start;
+  }
+
+
   /// LiveInterval - This class represents some number of live ranges for a
   /// register or value.  This class also contains a bit of register allocator
   /// state.