[PATCH] D156016: [Support] Change MapVector's default template parameter to SmallVector<*, 0>
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 22:04:13 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfb2a971c015f: [Support] Change MapVector's default template parameter to SmallVector<*, 0> (authored by MaskRay).
Herald added subscribers: bviyer, Moerafaat, zero9178, bzcheeseman, sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, stephenneuendorffer, liufengdb, aartbik, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, rriddle, mehdi_amini.
Herald added a reviewer: rriddle.
Herald added a reviewer: aartbik.
Herald added a project: MLIR.
Changed prior to commit:
https://reviews.llvm.org/D156016?vs=543141&id=543816#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156016/new/
https://reviews.llvm.org/D156016
Files:
lld/MachO/UnwindInfoSection.cpp
llvm/include/llvm/ADT/MapVector.h
llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
mlir/lib/IR/AsmPrinter.cpp
Index: mlir/lib/IR/AsmPrinter.cpp
===================================================================
--- mlir/lib/IR/AsmPrinter.cpp
+++ mlir/lib/IR/AsmPrinter.cpp
@@ -975,8 +975,8 @@
void AliasInitializer::initializeAliases(
llvm::MapVector<const void *, InProgressAliasInfo> &visitedSymbols,
llvm::MapVector<const void *, SymbolAlias> &symbolToAlias) {
- std::vector<std::pair<const void *, InProgressAliasInfo>> unprocessedAliases =
- visitedSymbols.takeVector();
+ SmallVector<std::pair<const void *, InProgressAliasInfo>, 0>
+ unprocessedAliases = visitedSymbols.takeVector();
llvm::stable_sort(unprocessedAliases, [](const auto &lhs, const auto &rhs) {
return lhs.second < rhs.second;
});
Index: llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -266,7 +266,9 @@
unsigned NumInsts = 0;
// Map from callee ValueId to profile count. Used to accumulate profile
// counts for all static calls to a given callee.
- MapVector<ValueInfo, CalleeInfo> CallGraphEdges;
+ MapVector<ValueInfo, CalleeInfo, DenseMap<ValueInfo, unsigned>,
+ std::vector<std::pair<ValueInfo, CalleeInfo>>>
+ CallGraphEdges;
SetVector<ValueInfo> RefEdges, LoadRefEdges, StoreRefEdges;
SetVector<GlobalValue::GUID> TypeTests;
SetVector<FunctionSummary::VFuncId> TypeTestAssumeVCalls,
Index: llvm/include/llvm/ADT/MapVector.h
===================================================================
--- llvm/include/llvm/ADT/MapVector.h
+++ llvm/include/llvm/ADT/MapVector.h
@@ -10,7 +10,7 @@
/// This file implements a map that provides insertion order iteration. The
/// interface is purposefully minimal. The key is assumed to be cheap to copy
/// and 2 copies are kept, one for indexing in a DenseMap, one for iteration in
-/// a std::vector.
+/// a SmallVector.
///
//===----------------------------------------------------------------------===//
@@ -24,16 +24,15 @@
#include <iterator>
#include <type_traits>
#include <utility>
-#include <vector>
namespace llvm {
/// This class implements a map that also provides access to all stored values
-/// in a deterministic order. The values are kept in a std::vector and the
+/// in a deterministic order. The values are kept in a SmallVector<*, 0> and the
/// mapping is done with DenseMap from Keys to indexes in that vector.
-template<typename KeyT, typename ValueT,
- typename MapType = DenseMap<KeyT, unsigned>,
- typename VectorType = std::vector<std::pair<KeyT, ValueT>>>
+template <typename KeyT, typename ValueT,
+ typename MapType = DenseMap<KeyT, unsigned>,
+ typename VectorType = SmallVector<std::pair<KeyT, ValueT>, 0>>
class MapVector {
MapType Map;
VectorType Vector;
Index: lld/MachO/UnwindInfoSection.cpp
===================================================================
--- lld/MachO/UnwindInfoSection.cpp
+++ lld/MachO/UnwindInfoSection.cpp
@@ -146,7 +146,7 @@
Symbol *canonicalizePersonality(Symbol *);
uint64_t unwindInfoSize = 0;
- std::vector<decltype(symbols)::value_type> symbolsVec;
+ SmallVector<decltype(symbols)::value_type, 0> symbolsVec;
CompactUnwindLayout cuLayout;
std::vector<std::pair<compact_unwind_encoding_t, size_t>> commonEncodings;
EncodingMap commonEncodingIndexes;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156016.543816.patch
Type: text/x-patch
Size: 3436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230725/77c1133e/attachment.bin>
More information about the llvm-commits
mailing list