[llvm] r369581 - Use C++14 heteregenous lookup for a couple of std::map<std::string, ...>

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 14:17:34 PDT 2019


Author: d0k
Date: Wed Aug 21 14:17:34 2019
New Revision: 369581

URL: http://llvm.org/viewvc/llvm-project?rev=369581&view=rev
Log:
Use C++14 heteregenous lookup for a couple of std::map<std::string, ...>

These call find with a StringRef, heterogenous lookup saves a temporary
std::string there.

Modified:
    llvm/trunk/include/llvm/IR/Attributes.h
    llvm/trunk/include/llvm/ProfileData/SampleProf.h
    llvm/trunk/include/llvm/TableGen/Record.h

Modified: llvm/trunk/include/llvm/IR/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=369581&r1=369580&r2=369581&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Attributes.h (original)
+++ llvm/trunk/include/llvm/IR/Attributes.h Wed Aug 21 14:17:34 2019
@@ -705,7 +705,7 @@ template <> struct DenseMapInfo<Attribut
 /// 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;

Modified: llvm/trunk/include/llvm/ProfileData/SampleProf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/SampleProf.h?rev=369581&r1=369580&r2=369581&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/SampleProf.h (original)
+++ llvm/trunk/include/llvm/ProfileData/SampleProf.h Wed Aug 21 14:17:34 2019
@@ -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.

Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=369581&r1=369580&r2=369581&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Wed Aug 21 14:17:34 2019
@@ -1687,10 +1687,10 @@ raw_ostream &operator<<(raw_ostream &OS,
 
 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:




More information about the llvm-commits mailing list