aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2013-02-25 21:32:40 +0000
committerTed Kremenek <kremenek@apple.com>2013-02-25 21:32:40 +0000
commit6f8e9b6caed0bf6108cf90f0d54fa637b60b3b9e (patch)
tree18489fbe279bc238021b2ef19775965d12d2dac7 /lib/StaticAnalyzer/Core/ExplodedGraph.cpp
parent742d9e77e32f014194679575c97c6bb4fd0998c4 (diff)
[analyzer] Recover all PreStmtPurgeDeadSymbols nodes with a single successor or predecessor.
These nodes are never consulted by any analyzer client code, so they are used only for machinery for removing dead bindings. Once successor nodes are generated they can be safely removed. This greatly reduces the amount of nodes that are generated in some case, lowering the memory regression when analyzing Sema.cpp introduced by r176010 from 14% to 2%. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/ExplodedGraph.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/ExplodedGraph.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
index 02268c410a..a44c28341b 100644
--- a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
+++ b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
@@ -65,10 +65,24 @@ bool ExplodedGraph::isInterestingLValueExpr(const Expr *Ex) {
}
bool ExplodedGraph::shouldCollect(const ExplodedNode *node) {
- // Reclaim all nodes that match *all* the following criteria:
+ // First, we only consider nodes for reclamation of the following
+ // conditions apply:
//
// (1) 1 predecessor (that has one successor)
// (2) 1 successor (that has one predecessor)
+ //
+ // If a node has no successor it is on the "frontier", while a node
+ // with no predecessor is a root.
+ //
+ // After these prerequisites, we discard all "filler" nodes that
+ // are used only for intermediate processing, and are not essential
+ // for analyzer history:
+ //
+ // (a) PreStmtPurgeDeadSymbols
+ //
+ // We then discard all other nodes where *all* of the following conditions
+ // apply:
+ //
// (3) The ProgramPoint is for a PostStmt, but not a PostStore.
// (4) There is no 'tag' for the ProgramPoint.
// (5) The 'store' is the same as the predecessor.
@@ -92,8 +106,13 @@ bool ExplodedGraph::shouldCollect(const ExplodedNode *node) {
if (succ->pred_size() != 1)
return false;
- // Condition 3.
+ // Now reclaim any nodes that are (by definition) not essential to
+ // analysis history and are not consulted by any client code.
ProgramPoint progPoint = node->getLocation();
+ if (progPoint.getAs<PreStmtPurgeDeadSymbols>())
+ return true;
+
+ // Condition 3.
if (!progPoint.getAs<PostStmt>() || progPoint.getAs<PostStore>())
return false;