diff options
| author | Justin Lebar <jlebar@google.com> | 2016-10-21 21:45:01 +0000 |
|---|---|---|
| committer | Justin Lebar <jlebar@google.com> | 2016-10-21 21:45:01 +0000 |
| commit | 5e83dfedb8d45a7c3ef3984757d5e071eb1f2a52 (patch) | |
| tree | f8df29440523a5e79c6485ca9f33ae5037d3e96f /clang/lib/CodeGen | |
| parent | 104887ed08fb6889a4719ab3c465383440ca2826 (diff) | |
| download | bcm5719-llvm-5e83dfedb8d45a7c3ef3984757d5e071eb1f2a52.tar.gz bcm5719-llvm-5e83dfedb8d45a7c3ef3984757d5e071eb1f2a52.zip | |
Switch SmallSetVector to use DenseSet when it overflows its inline space.
Summary:
SetVector already used DenseSet, but SmallSetVector used std::set. This
leads to surprising performance differences. Moreover, it means that
the set of key types accepted by SetVector and SmallSetVector are
quite different!
In order to make this change, we had to convert some callsites that used
SmallSetVector<std::string, N> to use SmallSetVector<CachedHashString, N>
instead.
Reviewers: timshen
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D25648
llvm-svn: 284887
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 70fefec574d..b290ae37239 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -11,9 +11,9 @@ // //===----------------------------------------------------------------------===// -#include "CGObjCRuntime.h" #include "CGBlocks.h" #include "CGCleanup.h" +#include "CGObjCRuntime.h" #include "CGRecordLayout.h" #include "CodeGenFunction.h" #include "CodeGenModule.h" @@ -25,6 +25,7 @@ #include "clang/Basic/LangOptions.h" #include "clang/CodeGen/CGFunctionInfo.h" #include "clang/Frontend/CodeGenOptions.h" +#include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" @@ -843,7 +844,7 @@ protected: llvm::DenseMap<Selector, llvm::GlobalVariable*> MethodVarNames; /// DefinedCategoryNames - list of category names in form Class_Category. - llvm::SmallSetVector<std::string, 16> DefinedCategoryNames; + llvm::SmallSetVector<llvm::CachedHashString, 16> DefinedCategoryNames; /// MethodVarTypes - uniqued method type signatures. We have to use /// a StringMap here because have no other unique reference. @@ -3156,7 +3157,7 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { "__OBJC,__category,regular,no_dead_strip", CGM.getPointerAlign(), true); DefinedCategories.push_back(GV); - DefinedCategoryNames.insert(ExtName.str()); + DefinedCategoryNames.insert(llvm::CachedHashString(ExtName)); // method definition entries must be clear for next implementation. MethodDefinitions.clear(); } |

