Enhance BranchProbabilityInfo::calcUnreachableHeuristics for InvokeInst
[oota-llvm.git] / lib / Analysis / StratifiedSets.h
index 3000d5bce8160bfa514981ad1372f343c9ca4074..fd3fbc0d86ad631fc2a413c35bc7dfec8a965dc0 100644 (file)
@@ -21,6 +21,7 @@
 #include <cmath>
 #include <limits>
 #include <type_traits>
+#include <utility>
 #include <vector>
 
 namespace llvm {
@@ -53,8 +54,7 @@ struct StratifiedLink {
   // Optional<StratifiedIndex> because Optional<StratifiedIndex> would
   // eat up a considerable amount of extra memory, after struct
   // padding/alignment is taken into account.
-  static LLVM_CONSTEXPR auto SetSentinel =
-      std::numeric_limits<StratifiedIndex>::max();
+  static const StratifiedIndex SetSentinel;
 
   // \brief The index for the set "above" current
   StratifiedIndex Above;
@@ -319,7 +319,7 @@ template <typename T> class StratifiedSetsBuilder {
       }
 
       StratifiedIndex Number = StratLinks.size();
-      Remaps.insert({Link.Number, Number});
+      Remaps.insert(std::make_pair(Link.Number, Number));
       StratLinks.push_back(Link.getLink());
     }
 
@@ -363,7 +363,7 @@ template <typename T> class StratifiedSetsBuilder {
     SmallSet<StratifiedIndex, 16> Visited;
     for (unsigned I = 0, E = Links.size(); I < E; ++I) {
       auto CurrentIndex = getHighestParentAbove(I);
-      if (!Visited.insert(CurrentIndex)) {
+      if (!Visited.insert(CurrentIndex).second) {
         continue;
       }
 
@@ -494,7 +494,7 @@ private:
   // necessary.
   bool addAtMerging(const T &ToAdd, StratifiedIndex Index) {
     StratifiedInfo Info = {Index};
-    auto Pair = Values.insert({ToAdd, Info});
+    auto Pair = Values.insert(std::make_pair(ToAdd, Info));
     if (Pair.second)
       return true;
 
@@ -686,7 +686,7 @@ private:
     return Link;
   }
 
-  bool inbounds(StratifiedIndex N) const { return N >= 0 && N < Links.size(); }
+  bool inbounds(StratifiedIndex N) const { return N < Links.size(); }
 };
 }
 #endif // LLVM_ADT_STRATIFIEDSETS_H