r176050 - [analyzer] Recover all PreStmtPurgeDeadSymbols nodes with a single successor or predecessor.

Ted Kremenek kremenek at apple.com
Mon Feb 25 13:32:40 PST 2013


Author: kremenek
Date: Mon Feb 25 15:32:40 2013
New Revision: 176050

URL: http://llvm.org/viewvc/llvm-project?rev=176050&view=rev
Log:
[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%.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp?rev=176050&r1=176049&r2=176050&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp Mon Feb 25 15:32:40 2013
@@ -65,10 +65,24 @@ bool ExplodedGraph::isInterestingLValueE
 }
 
 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
   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;
 





More information about the cfe-commits mailing list