]> granicus.if.org Git - llvm/commitdiff
Use C++14 heteregenous lookup for a couple of std::map<std::string, ...>
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 21 Aug 2019 21:17:34 +0000 (21:17 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 21 Aug 2019 21:17:34 +0000 (21:17 +0000)
These call find with a StringRef, heterogenous lookup saves a temporary
std::string there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369581 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Attributes.h
include/llvm/ProfileData/SampleProf.h
include/llvm/TableGen/Record.h

index 4efa3a9821c43958aedb650556f0caf0b063adff..719b9992cce1d5f2dba647c17a053b6f71bcefff 100644 (file)
@@ -705,7 +705,7 @@ template <> struct DenseMapInfo<AttributeList> {
 /// equality, presence of attributes, etc.
 class AttrBuilder {
   std::bitset<Attribute::EndAttrKinds> Attrs;
-  std::map<std::string, std::string> TargetDepAttrs;
+  std::map<std::string, std::string, std::less<>> TargetDepAttrs;
   MaybeAlign Alignment;
   MaybeAlign StackAlignment;
   uint64_t DerefBytes = 0;
index 453e1a08bd01d8e9eb7cc96c3cc56ff563d60303..37cdb5cf2bafa627c067cf795e02312645d1b080 100644 (file)
@@ -228,7 +228,7 @@ class FunctionSamples;
 using BodySampleMap = std::map<LineLocation, SampleRecord>;
 // NOTE: Using a StringMap here makes parsed profiles consume around 17% more
 // memory, which is *very* significant for large profiles.
-using FunctionSamplesMap = std::map<std::string, FunctionSamples>;
+using FunctionSamplesMap = std::map<std::string, FunctionSamples, std::less<>>;
 using CallsiteSampleMap = std::map<LineLocation, FunctionSamplesMap>;
 
 /// Representation of the samples collected for a function.
index 6a3e2a9169e1b60534fc96d983c265f7a206b01e..606ab1c901b22bd22bfc4af64e0f44906c9f2d3e 100644 (file)
@@ -1687,10 +1687,10 @@ raw_ostream &operator<<(raw_ostream &OS, const Record &R);
 
 class RecordKeeper {
   friend class RecordRecTy;
-  using RecordMap = std::map<std::string, std::unique_ptr<Record>>;
+  using RecordMap = std::map<std::string, std::unique_ptr<Record>, std::less<>>;
   RecordMap Classes, Defs;
   FoldingSet<RecordRecTy> RecordTypePool;
-  std::map<std::string, Init *> ExtraGlobals;
+  std::map<std::string, Init *, std::less<>> ExtraGlobals;
   unsigned AnonCounter = 0;
 
 public: