Fix Punctuation.
[oota-llvm.git] / lib / CodeGen / LiveInterval.cpp
index 6a6ecf78f68e26e0cbe9d6823211b3248da8e6e6..fad11fa080660b04a61981ad93c9fa0ea698a45e 100644 (file)
 #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 ends.
+namespace {
+struct CompEnd {
+  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);
+  assert(Pos.isValid() && "Cannot search for an invalid index");
+  return std::upper_bound(begin(), end(), LiveRange(SlotIndex(), Pos, 0),
+                          CompEnd());
 }
 
 /// killedInRange - Return true if the interval has kills in [Start,End).
@@ -578,6 +583,9 @@ VNInfo* LiveInterval::MergeValueNumberInto(VNInfo *V1, VNInfo *V2) {
     }
   }
 
+  // Merge the relevant flags.
+  V2->mergeFlags(V1);
+
   // Now that V1 is dead, remove it.
   markValNoForDeletion(V1);
 
@@ -674,10 +682,9 @@ void LiveInterval::print(raw_ostream &OS, const TargetRegisterInfo *TRI) const {
       if (vni->isUnused()) {
         OS << "x";
       } else {
-        if (!vni->isDefAccurate() && !vni->isPHIDef())
-          OS << "?";
-        else
-          OS << vni->def;
+        OS << vni->def;
+        if (vni->isPHIDef())
+          OS << "-phidef";
         if (vni->hasPHIKill())
           OS << "-phikill";
         if (vni->hasRedefByEC())