[llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.h LiveInterval.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Jul 23 11:13:34 PDT 2004



Changes in directory llvm/lib/CodeGen:

LiveInterval.h updated: 1.1 -> 1.2
LiveInterval.cpp updated: 1.1 -> 1.2

---
Log message:

Instead of searching for a live interval pair, search for a location.  This gives
a very modest speedup of .3 seconds compiling 176.gcc (out of 20s).


---
Diffs of the changes:  (+9 -6)

Index: llvm/lib/CodeGen/LiveInterval.h
diff -u llvm/lib/CodeGen/LiveInterval.h:1.1 llvm/lib/CodeGen/LiveInterval.h:1.2
--- llvm/lib/CodeGen/LiveInterval.h:1.1	Fri Jul 23 12:49:16 2004
+++ llvm/lib/CodeGen/LiveInterval.h	Fri Jul 23 13:13:24 2004
@@ -47,6 +47,11 @@
   };
   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: llvm/lib/CodeGen/LiveInterval.cpp
diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.1 llvm/lib/CodeGen/LiveInterval.cpp:1.2
--- llvm/lib/CodeGen/LiveInterval.cpp:1.1	Fri Jul 23 12:49:16 2004
+++ llvm/lib/CodeGen/LiveInterval.cpp	Fri Jul 23 13:13:24 2004
@@ -30,16 +30,14 @@
 // 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():





More information about the llvm-commits mailing list