Fast-ISel: Remove dead code after falling back from selecting call instructions ...
[oota-llvm.git] / lib / Analysis / CFLAliasAnalysis.cpp
index 398ee020aefb6d51aa1a3ed8988c7d48d6234a15..1bf1c335795492bed7ef9c77bf4fed57772ff873 100644 (file)
@@ -73,6 +73,9 @@ static Optional<Value *> getTargetValue(Instruction *);
 // This notes that we should ignore those.
 static bool hasUsefulEdges(Instruction *);
 
+const StratifiedIndex StratifiedLink::SetSentinel =
+  std::numeric_limits<StratifiedIndex>::max();
+
 namespace {
 // StratifiedInfo Attribute things.
 typedef unsigned StratifiedAttr;
@@ -137,6 +140,10 @@ struct FunctionInfo {
   StratifiedSets<Value *> Sets;
   // Lots of functions have < 4 returns. Adjust as necessary.
   SmallVector<Value *, 4> ReturnedValues;
+
+  FunctionInfo(StratifiedSets<Value *> &&S,
+               SmallVector<Value *, 4> &&RV)
+    : Sets(std::move(S)), ReturnedValues(std::move(RV)) {}
 };
 
 struct CFLAliasAnalysis;
@@ -343,13 +350,13 @@ public:
   tryInterproceduralAnalysis(const SmallVectorImpl<Function *> &Fns,
                              Value *FuncValue,
                              const iterator_range<User::op_iterator> &Args) {
-    LLVM_CONSTEXPR unsigned ExpectedMaxArgs = 8;
-    LLVM_CONSTEXPR unsigned MaxSupportedArgs = 50;
+    const unsigned ExpectedMaxArgs = 8;
+    const unsigned MaxSupportedArgs = 50;
     assert(Fns.size() > 0);
 
     // I put this here to give us an upper bound on time taken by IPA. Is it
     // really (realistically) needed? Keep in mind that we do have an n^2 algo.
-    if (std::distance(Args.begin(), Args.end()) > MaxSupportedArgs)
+    if (std::distance(Args.begin(), Args.end()) > (int) MaxSupportedArgs)
       return false;
 
     // Exit early if we'll fail anyway
@@ -400,8 +407,8 @@ public:
           }
         }
         if (AddEdge)
-          Output.push_back({FuncValue, ArgVal, EdgeType::Assign,
-                            StratifiedAttrs().flip()});
+          Output.push_back(Edge(FuncValue, ArgVal, EdgeType::Assign,
+                            StratifiedAttrs().flip()));
       }
 
       if (Parameters.size() != Arguments.size())
@@ -537,12 +544,15 @@ public:
   typedef std::size_t Node;
 
 private:
-  LLVM_CONSTEXPR static Node StartNode = Node(0);
+  const static Node StartNode = Node(0);
 
   struct Edge {
     EdgeTypeT Weight;
     Node Other;
 
+    Edge(const EdgeTypeT &W, const Node &N)
+      : Weight(W), Other(N) {}
+
     bool operator==(const Edge &E) const {
       return Weight == E.Weight && Other == E.Other;
     }
@@ -620,7 +630,7 @@ public:
 
   // ----- Actual graph-related things ----- //
 
-  WeightedBidirectionalGraph() = default;
+  WeightedBidirectionalGraph() {}
 
   WeightedBidirectionalGraph(WeightedBidirectionalGraph<EdgeTypeT> &&Other)
       : NodeImpls(std::move(Other.NodeImpls)) {}
@@ -644,8 +654,8 @@ public:
     assert(inbounds(To));
     auto &FromNode = getNode(From);
     auto &ToNode = getNode(To);
-    FromNode.Edges.push_back(Edge{Weight, To});
-    ToNode.Edges.push_back(Edge{ReverseWeight, From});
+    FromNode.Edges.push_back(Edge(Weight, To));
+    ToNode.Edges.push_back(Edge(ReverseWeight, From));
   }
 
   EdgeIterable edgesFor(const Node &N) const {
@@ -834,7 +844,8 @@ static void buildGraphFrom(CFLAliasAnalysis &Analysis, Function *Fn,
         auto From = findOrInsertNode(E.From);
         auto FlippedWeight = flipWeight(E.Weight);
         auto Attrs = E.AdditionalAttrs;
-        Graph.addEdge(From, To, {E.Weight, Attrs}, {FlippedWeight, Attrs});
+        Graph.addEdge(From, To, std::make_pair(E.Weight, Attrs),
+                                std::make_pair(FlippedWeight, Attrs));
       }
     }
   }
@@ -918,7 +929,7 @@ static FunctionInfo buildSetsFrom(CFLAliasAnalysis &Analysis, Function *Fn) {
     Builder.add(&Arg);
   }
 
-  return {Builder.build(), std::move(ReturnedValues)};
+  return FunctionInfo(Builder.build(), std::move(ReturnedValues));
 }
 
 void CFLAliasAnalysis::scan(Function *Fn) {