From: Matthias Braun Date: Sat, 30 Jan 2016 01:27:06 +0000 (+0000) Subject: Avoid overly large SmallPtrSet/SmallSet X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=63f7c930852ffe13b07ef4182fdd6e01f02538aa;p=clang Avoid overly large SmallPtrSet/SmallSet These sets perform linear searching in small mode so it is never a good idea to use SmallSize/N bigger than 32. Differential Revision: http://reviews.llvm.org/D16705 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259284 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/PseudoConstantAnalysis.cpp b/lib/Analysis/PseudoConstantAnalysis.cpp index 5b917a7a27..614f676fb1 100644 --- a/lib/Analysis/PseudoConstantAnalysis.cpp +++ b/lib/Analysis/PseudoConstantAnalysis.cpp @@ -22,9 +22,7 @@ using namespace clang; -// The number of ValueDecls we want to keep track of by default (per-function) -#define VARDECL_SET_SIZE 256 -typedef llvm::SmallPtrSet VarDeclSet; +typedef llvm::SmallPtrSet VarDeclSet; PseudoConstantAnalysis::PseudoConstantAnalysis(const Stmt *DeclBody) : DeclBody(DeclBody), Analyzed(false) { diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 7b1bc2f490..89d99906a0 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -3843,7 +3843,7 @@ public: } } - typedef llvm::SmallPtrSet::iterator iterator; + typedef llvm::SmallPtrSetImpl::iterator iterator; iterator begin() const { return Overridden.begin(); } iterator end() const { return Overridden.end(); } diff --git a/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp b/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp index a052d83f5a..64c30e7a82 100644 --- a/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp @@ -43,7 +43,7 @@ void AnalyzerStatsChecker::checkEndAnalysis(ExplodedGraph &G, ExprEngine &Eng) const { const CFG *C = nullptr; const SourceManager &SM = B.getSourceManager(); - llvm::SmallPtrSet reachable; + llvm::SmallPtrSet reachable; // Root node should have the location context of the top most function. const ExplodedNode *GraphRoot = *G.roots_begin(); diff --git a/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp b/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp index a03abce962..892e713d24 100644 --- a/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp @@ -26,10 +26,6 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h" #include "llvm/ADT/SmallSet.h" -// The number of CFGBlock pointers we want to reserve memory for. This is used -// once for each function we analyze. -#define DEFAULT_CFGBLOCKS 256 - using namespace clang; using namespace ento; @@ -39,7 +35,7 @@ public: void checkEndAnalysis(ExplodedGraph &G, BugReporter &B, ExprEngine &Eng) const; private: - typedef llvm::SmallSet CFGBlocksSet; + typedef llvm::SmallSet CFGBlocksSet; static inline const Stmt *getUnreachableStmt(const CFGBlock *CB); static void FindUnreachableEntryPoints(const CFGBlock *CB,