From 81faa5e6a26cc1b92301438a8e8ec8ce6bf5e574 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 21 Aug 2019 21:17:34 +0000 Subject: [PATCH] Use C++14 heteregenous lookup for a couple of std::map These call find with a StringRef, heterogenous lookup saves a temporary std::string there. llvm-svn: 369581 --- clang/include/clang/ASTMatchers/ASTMatchersInternal.h | 3 ++- llvm/include/llvm/IR/Attributes.h | 2 +- llvm/include/llvm/ProfileData/SampleProf.h | 2 +- llvm/include/llvm/TableGen/Record.h | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h index ae7b9e7..e9fa920 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -183,7 +183,8 @@ public: /// Note that we're using std::map here, as for memoization: /// - we need a comparison operator /// - we need an assignment operator - using IDToNodeMap = std::map; + using IDToNodeMap = + std::map>; const IDToNodeMap &getMap() const { return NodeMap; diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h index 4efa3a9..719b999 100644 --- a/llvm/include/llvm/IR/Attributes.h +++ b/llvm/include/llvm/IR/Attributes.h @@ -705,7 +705,7 @@ template <> struct DenseMapInfo { /// equality, presence of attributes, etc. class AttrBuilder { std::bitset Attrs; - std::map TargetDepAttrs; + std::map> TargetDepAttrs; MaybeAlign Alignment; MaybeAlign StackAlignment; uint64_t DerefBytes = 0; diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h index 453e1a0..37cdb5c 100644 --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -228,7 +228,7 @@ class FunctionSamples; using BodySampleMap = std::map; // NOTE: Using a StringMap here makes parsed profiles consume around 17% more // memory, which is *very* significant for large profiles. -using FunctionSamplesMap = std::map; +using FunctionSamplesMap = std::map>; using CallsiteSampleMap = std::map; /// Representation of the samples collected for a function. diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h index 6a3e2a9..606ab1c 100644 --- a/llvm/include/llvm/TableGen/Record.h +++ b/llvm/include/llvm/TableGen/Record.h @@ -1687,10 +1687,10 @@ raw_ostream &operator<<(raw_ostream &OS, const Record &R); class RecordKeeper { friend class RecordRecTy; - using RecordMap = std::map>; + using RecordMap = std::map, std::less<>>; RecordMap Classes, Defs; FoldingSet RecordTypePool; - std::map ExtraGlobals; + std::map> ExtraGlobals; unsigned AnonCounter = 0; public: -- 2.7.4