[llvm-commits] [poolalloc] r117564 - /poolalloc/trunk/lib/DSA/DSGraph.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Thu Oct 28 10:41:02 PDT 2010


Author: aggarwa4
Date: Thu Oct 28 12:41:02 2010
New Revision: 117564

URL: http://llvm.org/viewvc/llvm-project?rev=117564&view=rev
Log:
Ensure correct copying of globals into callee graph. Clone AuxCalls
that reach cloned nodes first. This ensure that globals that reach
any nodes cloned due to the AuxCall, are also cloned.

Modified:
    poolalloc/trunk/lib/DSA/DSGraph.cpp

Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSGraph.cpp?rev=117564&r1=117563&r2=117564&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSGraph.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSGraph.cpp Thu Oct 28 12:41:02 2010
@@ -352,18 +352,18 @@
     NodeInfo.insert(NodeInfoIt,
                     std::make_pair(N, std::make_pair(MyId, false)))->second;
 
-  // Base case: if we find a global, this doesn't reach the cloned graph
-  // portion.
-  if (N->isGlobalNode()) {
-    ThisNodeInfo.second = false;
-    return ThisNodeInfo;
-  }
 
   // Base case: if this does reach the cloned graph portion... it does. :)
   if (RC.hasClonedNode(N)) {
     ThisNodeInfo.second = true;
     return ThisNodeInfo;
   }
+  // Base case: if we find a global, this doesn't reach the cloned graph
+  // portion.
+  if (N->isGlobalNode()) {
+    ThisNodeInfo.second = false;
+    return ThisNodeInfo;
+  }
 
   SCCStack.push_back(N);
 
@@ -485,6 +485,12 @@
 //  	if (!List.size())
 //  	  AuxCallToCopy.push_back(&*I);
 //        }
+  
+  // Copy aux calls that are needed.
+  // Copy these before calculating the globals to be copied, as there might be
+  // globals that reach the nodes cloned due to aux calls.
+  for (unsigned i = 0, e = AuxCallToCopy.size(); i != e; ++i)
+    AuxFunctionCalls.push_back(DSCallSite(*AuxCallToCopy[i], RC));
 
   const DSScalarMap &GSM = Graph.getScalarMap();
   for (DSScalarMap::global_iterator GI = GSM.global_begin(),
@@ -498,10 +504,6 @@
       }
   }
 
-  // Copy aux calls that are needed.
-  for (unsigned i = 0, e = AuxCallToCopy.size(); i != e; ++i)
-    AuxFunctionCalls.push_back(DSCallSite(*AuxCallToCopy[i], RC));
-
   // Copy globals that are needed.
   for (unsigned i = 0, e = GlobalsToCopy.size(); i != e; ++i)
     RC.getClonedNH(Graph.getNodeForValue(GlobalsToCopy[i]));





More information about the llvm-commits mailing list