[llvm-commits] [poolalloc] r104166 - /poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp

John Criswell criswell at uiuc.edu
Wed May 19 14:26:57 PDT 2010


Author: criswell
Date: Wed May 19 16:26:56 2010
New Revision: 104166

URL: http://llvm.org/viewvc/llvm-project?rev=104166&view=rev
Log:
Handle the case where a DSNode::iterator can represent a NULL DSNode.
Improved comment formatting.

Modified:
    poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp

Modified: poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp?rev=104166&r1=104165&r2=104166&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/Heuristic.cpp Wed May 19 16:26:56 2010
@@ -184,18 +184,32 @@
     for (DSGraph::node_iterator I = G->node_begin(), E = G->node_end();
          I != E; ++I) {
       DSNode *N = I;
+#if 0
+      //
       // Ignore nodes that are just globals and not arrays.
-      /*
+      //
       if (N->isArray() || N->isHeapNode() || N->isAllocaNode() ||
           N->isUnknownNode())
-      */
+#endif
       // If a node is marked, all children are too.
-      if (!ReachableFromMemory.count(N))
-        for (DSNode::iterator NI = N->begin(), E = N->end(); NI != E; ++NI)
+      if (!ReachableFromMemory.count(N)) {
+        for (DSNode::iterator NI = N->begin(), E = N->end(); NI != E; ++NI) {
+          //
+          // Sometimes this results in a NULL DSNode.  Skip it if that is the
+          // case.
+          //
+          if (!(*NI)) continue;
+
+          //
+          // Do a depth-first iteration over the DSGraph starting with this
+          // child node.
+          //
           for (df_ext_iterator<const DSNode*>
                  DI = df_ext_begin(*NI, ReachableFromMemory),
                  E = df_ext_end(*NI, ReachableFromMemory); DI != E; ++DI)
           /*empty*/;
+        }
+      }
     }
 
     // Only pool allocate a node if it is reachable from a memory object (itself





More information about the llvm-commits mailing list