[llvm-commits] [llvm] r126922 - /llvm/trunk/lib/CodeGen/LiveInterval.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Mar 2 20:23:52 PST 2011


Author: stoklund
Date: Wed Mar  2 22:23:52 2011
New Revision: 126922

URL: http://llvm.org/viewvc/llvm-project?rev=126922&view=rev
Log:
Avoid comparing invalid slot indexes.

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

Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=126922&r1=126921&r2=126922&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Wed Mar  2 22:23:52 2011
@@ -33,16 +33,18 @@
 // CompEnd - Compare LiveRange ends.
 namespace {
 struct CompEnd {
-  bool operator()(const LiveRange &A, const LiveRange &B) const {
-    return A.end < B.end;
+  bool operator()(SlotIndex A, const LiveRange &B) const {
+    return A < B.end;
+  }
+  bool operator()(const LiveRange &A, SlotIndex B) const {
+    return A.end < B;
   }
 };
 }
 
 LiveInterval::iterator LiveInterval::find(SlotIndex Pos) {
   assert(Pos.isValid() && "Cannot search for an invalid index");
-  return std::upper_bound(begin(), end(), LiveRange(SlotIndex(), Pos, 0),
-                          CompEnd());
+  return std::upper_bound(begin(), end(), Pos, CompEnd());
 }
 
 /// killedInRange - Return true if the interval has kills in [Start,End).





More information about the llvm-commits mailing list