Only clone global nodes between graphs if both graphs have the global.
authorChris Lattner <sabre@nondot.org>
Fri, 27 Feb 2004 20:05:15 +0000 (20:05 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 27 Feb 2004 20:05:15 +0000 (20:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11928 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/BottomUpClosure.cpp
lib/Analysis/DataStructure/DataStructure.cpp

index 2125064030eeeb91e2f687e1445d6c39d5606b50..08a5a1583490dba51e52d025464d8bd67e2d6331 100644 (file)
@@ -279,6 +279,9 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
       //
       DSGraph &GI = getDSGraph(*Callee);  // Graph to inline
       
+      if (Callee->getName() == "bc_raise")
+        std::cerr << "HERE!\n";
+
       DEBUG(std::cerr << "    Inlining graph for " << Callee->getName()
             << "[" << GI.getGraphSize() << "+"
             << GI.getAuxFunctionCalls().size() << "] into '"
index fd252304b24587e45d944ad7c3e09c9b764eafb6..270a0bf9e0c3cacf26a9808d88dcf9add440c8b9 100644 (file)
@@ -33,10 +33,6 @@ namespace {
   Statistic<> NumDNE            ("dsa", "Number of nodes removed by reachability");
   Statistic<> NumTrivialDNE     ("dsa", "Number of nodes trivially removed");
   Statistic<> NumTrivialGlobalDNE("dsa", "Number of globals trivially removed");
-
-  cl::opt<bool>
-  EnableDSNodeGlobalRootsHack("enable-dsa-globalrootshack", cl::Hidden,
-                cl::desc("Make DSA less aggressive when cloning graphs"));
 };
 
 #if 1
@@ -1239,15 +1235,12 @@ void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F,
         AuxFunctionCalls.push_back(DSCallSite(Graph.AuxFunctionCalls[i], RC));
     }
     
-    // If the user requested it, add the nodes that we need to clone to the
-    // RootNodes set.
-    if (!EnableDSNodeGlobalRootsHack)
-      // FIXME: Why is this not iterating over the globals in the graph??
-      for (node_iterator NI = Graph.node_begin(), E = Graph.node_end();
-           NI != E; ++NI)
-        if (!(*NI)->getGlobals().empty())
-          RC.getClonedNH(*NI);
-                                                 
+    // Clone over all globals that appear in the caller and callee graphs.
+    for (DSScalarMap::global_iterator GI = Graph.getScalarMap().global_begin(),
+           E = Graph.getScalarMap().global_end(); GI != E; ++GI)
+      if (GlobalVariable *GV = dyn_cast<GlobalVariable>(*GI))
+        if (ScalarMap.count(GV))
+          RC.merge(ScalarMap[GV], Graph.getNodeForValue(GV));
   } else {
     DSNodeHandle RetVal = getReturnNodeFor(F);