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

John Criswell criswell at uiuc.edu
Tue Aug 17 13:47:10 PDT 2010


Author: criswell
Date: Tue Aug 17 15:47:10 2010
New Revision: 111280

URL: http://llvm.org/viewvc/llvm-project?rev=111280&view=rev
Log:
Assign pools to incoming pointer arguments even if they are byval arguments.
This will help ensure that functions with different signatures get transformed
identically when they are targets of the same indirect function call.

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

Modified: poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp?rev=111280&r1=111279&r2=111280&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/PoolAllocate.cpp Tue Aug 17 15:47:10 2010
@@ -554,35 +554,24 @@
       if (AI != G->getScalarMap().end()) {
         if (DSNode *N = AI->second.getNode()) {
           //
-          // If this is a byval argument, then simply add all DSNodes which are
-          // reachable from it, but don't add the byval argument's node.  For
-          // all other parameters, add the DSNode for the parameter and all
-          // DSNodes reachable from it.
+          // Find all nodes reachable from this node.  Include this node, even
+          // if it is a byval argument.
+          //
+          // Now, I hear what you're thinking: "Why pass pools for byval
+          // arguments?"  Well, we want to pass pools for byval arguments
+          // because the function may be the target of an indirect function
+          // call, and the byval parameter could therefore alias with a
+          // non-byval argument from another function that is a target of the
+          // indirect function call.  Passing pools for byval arguments helps
+          // ensure that all targets of an indirect function call get
+          // transformed identically.
           //
-          if (I->hasByValAttr()) {
-            DSNode::edge_iterator link = N->edge_begin();
-            while (link != N->edge_end()) {
-              DSNodeHandle Child = link->second;
-              if (Child.getNode())
-                Child.getNode()->markReachableNodes(MarkedNodes);
-              ++link;
-            }
-          } else {
-            //
-            // Add all nodes reachable from this parameter into our set of
-            // nodes needing pools.
-            //
-            N->markReachableNodes(MarkedNodes);
-          }
 
           //
-          // If this is a byval argument, then we don't want to add it to the
-          // list of nodes that need an outside pool. However, anything
-          // reachable from the byval argument should have its pool passed in.
-          // So, we'll just remove the DSNode of the argument if it is marked
-          // byval.
+          // Add all nodes reachable from this parameter into our set of
+          // nodes needing pools.
           //
-          if (I->hasByValAttr()) MarkedNodes.erase (N);
+          N->markReachableNodes(MarkedNodes);
         }
       }
     }





More information about the llvm-commits mailing list