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

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Sep 21 11:24:31 PDT 2010


Author: stoklund
Date: Tue Sep 21 13:24:30 2010
New Revision: 114455

URL: http://llvm.org/viewvc/llvm-project?rev=114455&view=rev
Log:
MSVC9 does not support upper_bound with an asymmetric comparator.

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=114455&r1=114454&r2=114455&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Tue Sep 21 13:24:30 2010
@@ -30,14 +30,18 @@
 #include <algorithm>
 using namespace llvm;
 
-// compEnd - Compare LiveRange end to Pos.
-// This argument ordering works for upper_bound.
-static inline bool compEnd(SlotIndex Pos, const LiveRange &LR) {
-  return Pos < LR.end;
-}
+// CompEnd - Compare LiveRange end to Pos.
+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;
+  }
+};
 
 LiveInterval::iterator LiveInterval::find(SlotIndex Pos) {
-  return std::upper_bound(begin(), end(), Pos, 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