Refix MSVC9 and upper_bound. It actually needs a fully symmetric comparator.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 21 Sep 2010 20:16:12 +0000 (20:16 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Tue, 21 Sep 2010 20:16:12 +0000 (20:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114469 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveInterval.cpp

index fd5fe787b6bf07c6ce43970b99e3ae2de0803397..44101ffee7a1aa0986f538034b1966173eb79dc2 100644 (file)
 #include <algorithm>
 using namespace llvm;
 
-// CompEnd - Compare LiveRange end to Pos.
+// CompEnd - Compare LiveRange ends.
 namespace {
 struct CompEnd {
-  bool operator()(SlotIndex Pos, const LiveRange &LR) const {
-    return Pos < LR.end;
-  }
-  bool operator()(const LiveRange &LR, SlotIndex Pos) const {
-    return LR.end < Pos;
+  bool operator()(const LiveRange &A, const LiveRange &B) const {
+    return A.end < B.end;
   }
 };
 }
 
 LiveInterval::iterator LiveInterval::find(SlotIndex Pos) {
-  return std::upper_bound(begin(), end(), Pos, CompEnd());
+  return std::upper_bound(begin(), end(), LiveRange(SlotIndex(), Pos, 0),
+                          CompEnd());
 }
 
 /// killedInRange - Return true if the interval has kills in [Start,End).