@@ -851,7 +851,7 @@ class FunctionSummary : public GlobalValueSummary {
851
851
// / Create an empty FunctionSummary (with specified call edges).
852
852
// / Used to represent external nodes and the dummy root node.
853
853
static FunctionSummary
854
- makeDummyFunctionSummary (std::vector <FunctionSummary::EdgeTy> Edges) {
854
+ makeDummyFunctionSummary (SmallVectorImpl <FunctionSummary::EdgeTy> && Edges) {
855
855
return FunctionSummary (
856
856
FunctionSummary::GVFlags (
857
857
GlobalValue::LinkageTypes::AvailableExternallyLinkage,
@@ -880,7 +880,9 @@ class FunctionSummary : public GlobalValueSummary {
880
880
FFlags FunFlags;
881
881
882
882
// / List of <CalleeValueInfo, CalleeInfo> call edge pairs from this function.
883
- std::vector<EdgeTy> CallGraphEdgeList;
883
+ // / We use SmallVector<ValueInfo, 0> instead of std::vector<ValueInfo> for its
884
+ // / smaller memory footprint.
885
+ SmallVector<EdgeTy, 0 > CallGraphEdgeList;
884
886
885
887
std::unique_ptr<TypeIdInfo> TIdInfo;
886
888
@@ -910,7 +912,7 @@ class FunctionSummary : public GlobalValueSummary {
910
912
public:
911
913
FunctionSummary (GVFlags Flags, unsigned NumInsts, FFlags FunFlags,
912
914
SmallVectorImpl<ValueInfo> &&Refs,
913
- std::vector <EdgeTy> CGEdges,
915
+ SmallVectorImpl <EdgeTy> && CGEdges,
914
916
std::vector<GlobalValue::GUID> TypeTests,
915
917
std::vector<VFuncId> TypeTestAssumeVCalls,
916
918
std::vector<VFuncId> TypeCheckedLoadVCalls,
@@ -957,7 +959,7 @@ class FunctionSummary : public GlobalValueSummary {
957
959
// / Return the list of <CalleeValueInfo, CalleeInfo> pairs.
958
960
ArrayRef<EdgeTy> calls () const { return CallGraphEdgeList; }
959
961
960
- std::vector <EdgeTy> &mutableCalls () { return CallGraphEdgeList; }
962
+ SmallVector <EdgeTy, 0 > &mutableCalls () { return CallGraphEdgeList; }
961
963
962
964
void addCall (EdgeTy E) { CallGraphEdgeList.push_back (E); }
963
965
@@ -1535,7 +1537,7 @@ class ModuleSummaryIndex {
1535
1537
discoverNodes (ValueInfo (HaveGVs, &S), FunctionHasParent);
1536
1538
}
1537
1539
1538
- std::vector <FunctionSummary::EdgeTy> Edges;
1540
+ SmallVector <FunctionSummary::EdgeTy, 0 > Edges;
1539
1541
// create edges to all roots in the Index
1540
1542
for (auto &P : FunctionHasParent) {
1541
1543
if (P.second )
@@ -1544,9 +1546,11 @@ class ModuleSummaryIndex {
1544
1546
}
1545
1547
if (Edges.empty ()) {
1546
1548
// Failed to find root - return an empty node
1547
- return FunctionSummary::makeDummyFunctionSummary ({});
1549
+ return FunctionSummary::makeDummyFunctionSummary (
1550
+ SmallVector<FunctionSummary::EdgeTy, 0 >());
1548
1551
}
1549
- auto CallGraphRoot = FunctionSummary::makeDummyFunctionSummary (Edges);
1552
+ auto CallGraphRoot =
1553
+ FunctionSummary::makeDummyFunctionSummary (std::move (Edges));
1550
1554
return CallGraphRoot;
1551
1555
}
1552
1556
@@ -1894,10 +1898,11 @@ template <> struct GraphTraits<ValueInfo> {
1894
1898
return P.first ;
1895
1899
}
1896
1900
using ChildIteratorType =
1897
- mapped_iterator<std::vector <FunctionSummary::EdgeTy>::iterator,
1901
+ mapped_iterator<SmallVector <FunctionSummary::EdgeTy, 0 >::iterator,
1898
1902
decltype (&valueInfoFromEdge)>;
1899
1903
1900
- using ChildEdgeIteratorType = std::vector<FunctionSummary::EdgeTy>::iterator;
1904
+ using ChildEdgeIteratorType =
1905
+ SmallVector<FunctionSummary::EdgeTy, 0 >::iterator;
1901
1906
1902
1907
static NodeRef getEntryNode (ValueInfo V) { return V; }
1903
1908
0 commit comments