[PATCH] D16705: Avoid overly large SmallPtrSet/SmallSet

Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 29 17:31:14 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL259284: Avoid overly large SmallPtrSet/SmallSet (authored by matze).

Changed prior to commit:
  http://reviews.llvm.org/D16705?vs=46337&id=46457#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16705

Files:
  cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
  cfe/trunk/lib/Sema/SemaDeclObjC.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp

Index: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp
@@ -3843,7 +3843,7 @@
     }
   }
 
-  typedef llvm::SmallPtrSet<ObjCMethodDecl*, 128>::iterator iterator;
+  typedef llvm::SmallPtrSetImpl<ObjCMethodDecl*>::iterator iterator;
   iterator begin() const { return Overridden.begin(); }
   iterator end() const { return Overridden.end(); }
 
Index: cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
===================================================================
--- cfe/trunk/lib/Analysis/PseudoConstantAnalysis.cpp
+++ cfe/trunk/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<const VarDecl*, VARDECL_SET_SIZE> VarDeclSet;
+typedef llvm::SmallPtrSet<const VarDecl*, 32> VarDeclSet;
 
 PseudoConstantAnalysis::PseudoConstantAnalysis(const Stmt *DeclBody) :
       DeclBody(DeclBody), Analyzed(false) {
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ cfe/trunk/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 @@
   void checkEndAnalysis(ExplodedGraph &G, BugReporter &B,
                         ExprEngine &Eng) const;
 private:
-  typedef llvm::SmallSet<unsigned, DEFAULT_CFGBLOCKS> CFGBlocksSet;
+  typedef llvm::SmallSet<unsigned, 32> CFGBlocksSet;
 
   static inline const Stmt *getUnreachableStmt(const CFGBlock *CB);
   static void FindUnreachableEntryPoints(const CFGBlock *CB,
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
@@ -43,7 +43,7 @@
                                             ExprEngine &Eng) const {
   const CFG *C = nullptr;
   const SourceManager &SM = B.getSourceManager();
-  llvm::SmallPtrSet<const CFGBlock*, 256> reachable;
+  llvm::SmallPtrSet<const CFGBlock*, 32> reachable;
 
   // Root node should have the location context of the top most function.
   const ExplodedNode *GraphRoot = *G.roots_begin();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16705.46457.patch
Type: text/x-patch
Size: 2779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160130/6d2587ad/attachment.bin>


More information about the cfe-commits mailing list